제출 #22136

#제출 시각아이디문제언어결과실행 시간메모리
22136나자바봐랑 (#42)시간과 날짜 (KRIII5P_1)C11
7 / 7
0 ms1116 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...