明天是几号?oj

明天是几号?


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;
}


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值