Submission #22136

# Submission time Handle Problem Language Result Execution time Memory
22136 2017-04-29T11:17:02 Z 나자바봐랑(#1023, devetude) None (KRIII5P_1) C
7 / 7
0 ms 1116 KB
#include <stdio.h>

typedef enum {false, true} bool;

int main(int argc, const char * argv[]) {
    int T;
    scanf("%d", &T);
    
    while(T-- > 0) {
        int x = 0;
        int y = 0;
        scanf("%d %d", &x, &y);
        
        bool hour = (0 <= x && x <= 23 ? true : false);
        bool minute = (0 <= y && y <= 59 ? true : false);
        bool month = (1 <= x && x <= 12 ? true : false);
        bool day = false;
        
        if(x == 2) {
            day = (1 <= y && y <= 29 ? true : false);
        }
        
        else if(x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) {
            day = (1 <= y && y <= 31 ? true : false);
        }
        
        else if(month) {
            day = (1 <= y && y <= 30 ? true : false);
        }
        
        hour && minute ? printf("Yes ") : printf("No ");
        month && day ? printf("Yes\n") : printf("No\n");
    }
    
    return 0;
}

Compilation message

td.c: In function 'main':
td.c:7:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &T);
     ^
td.c:12:9: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &x, &y);
         ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1116 KB Output is correct