Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
597 | 张弛 | 判断某年某月天数 | C++ | 通过 | 100 | 0 MS | 252 KB | 1816 | 2019-09-21 12:18:42 |
#include<iostream> int main(){ int a,b; scanf("%d %d",&a,&b); if(a%100==0){ if(a%400==0){ switch(b){ case 1:printf("31");break; case 2:printf("29");break; case 3:printf("31");break; case 4:printf("30");break; case 5:printf("31");break; case 6:printf("30");break; case 7:printf("31");break; case 8:printf("31");break; case 9:printf("30");break; case 10:printf("31");break; case 11:printf("30");break; case 12:printf("31");break; } }else{ switch(b){ case 1:printf("31");break; case 2:printf("28");break; case 3:printf("31");break; case 4:printf("30");break; case 5:printf("31");break; case 6:printf("30");break; case 7:printf("31");break; case 8:printf("31");break; case 9:printf("30");break; case 10:printf("31");break; case 11:printf("30");break; case 12:printf("31");break; } } }else if(a%4==0){ switch(b){ case 1:printf("31");break; case 2:printf("29");break; case 3:printf("31");break; case 4:printf("30");break; case 5:printf("31");break; case 6:printf("30");break; case 7:printf("31");break; case 8:printf("31");break; case 9:printf("30");break; case 10:printf("31");break; case 11:printf("30");break; case 12:printf("31");break; } }else{ switch(b){ case 1:printf("31");break; case 2:printf("28");break; case 3:printf("31");break; case 4:printf("30");break; case 5:printf("31");break; case 6:printf("30");break; case 7:printf("31");break; case 8:printf("31");break; case 9:printf("30");break; case 10:printf("31");break; case 11:printf("30");break; case 12:printf("31");break; } } return 0; }