# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
22196 | 2017-04-29T17:17:58 Z | 내일 시험이에요(#1036, pjh0123) | 시간과 날짜 (KRIII5P_1) | C++11 | 3 ms | 1116 KB |
#include <cstdio> #include <cstdlib> int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int leap(int y){ return y%400?1:y%100?0:y%4?1:0; } int month(int x){ return 1<=x && x<=12; } int day(int y, int x){ if(!month(y))return 0; int d = days[y]; if(y==2)d+=leap(y); return 1<=x && x<=d; } int hour(int x){ return 0<=x && x<24; } int minute(int x){ return 0<=x && x<60; } int time(int h, int m){ return hour(h) && minute(m); } int main(){ int n; scanf("%d",&n); for(int i=0;i<n;i++){ int a,b; scanf("%d%d",&a,&b); printf("%s %s\n",time(a,b)?"Yes":"No", day(a,b)?"Yes":"No"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1116 KB | Output is correct |