# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22196 | 내일 시험이에요 (#42) | 시간과 날짜 (KRIII5P_1) | C++11 | 3 ms | 1116 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |