Submission #22196

#TimeUsernameProblemLanguageResultExecution timeMemory
22196내일 시험이에요 (#42)시간과 날짜 (KRIII5P_1)C++11
7 / 7
3 ms1116 KiB
#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)

td.cpp: In function 'int main()':
td.cpp:31:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
td.cpp:34:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&a,&b);
                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...