明天是几号?
Time Limit: 1000MS
Memory Limit: 65536KB
Problem Description
忙碌了一天的 bLue 累得瘫在床上,他想知道明天是几号,你能告诉他吗?
Input
输入数据有多组(数据组数不超过 50000),到 EOF 结束。
每组数据输入一行,包含用空格隔开的 3 个整数,表示今天的日期,分别为年、月、日。
保证输入日期的年份在 1900 到 2035 之间。
Output
对于每组数据,在一行中输出明天的日期,格式为 "y m d",分别表示年、月、日。
Example Input
2016 12 27 2016 2 29
Example Output
2016 12 28 2016 3 1
Hint
能被 4 整除且非整百年的,或能被 400 整除的为闰年。
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c;
int d,e,f;
while(scanf("%d %d %d",&a,&b,&c)!=EOF){
if(b==1){if(c <= 30){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==2){if(c <= 27){d=a,e=b,f=c+1;}else if(c==29){d=a,e=b+1;f=1;}}
if(b==3){if(c <= 30){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==4){if(c <= 29){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==5){if(c <= 30){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==6){if(c <= 29){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==7){if(c <= 30){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==8){if(c <= 30){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==9){if(c <= 29){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==10){if(c <= 30){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==11){if(c <= 29){d=a,e=b,f=c+1;}else{d=a,e=b+1;f=1;}}
if(b==12){if(c <= 30){d=a,e=b,f=c+1;}else{d=a+1,e=1;f=1;}}
if(b==2&&c==28){
if(a%4==0&&a%100!=0||a%400==0){d=a;e=2,f=29;}
else{d=a;e=3,f=1;}
}
printf("%d %d %d\n",d,e,f);
}
return 0;
}
1995

被折叠的 条评论
为什么被折叠?



