问题标题: 酷町堂:1367 以后(after)

0
0
宣瑞涵
宣瑞涵
高级守护
高级守护

题目链接: 酷町堂:1367

#include<iostream>

#include <algorithm>

using namespace std;

int a[15]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int x,y,z,n;

int main(){

    cin>>x>>y>>z>>n;

while(n--){

if((y%4==0&&y%100!=0)||y%400==0){

         a[2]=29;

}else{

         a[2]=28;

}

    z+=1;

    if(z>a[y]){

        y++;

        z=1;

        }if(y==13){

            y=1;

z=1;

            x++;

        }

    }

if(z>9&&y>9) cout<<x<<y<<z;

else if(z<=9&&y>9) cout<<x<<y<<"0"<<z;

else if(z>9&&y<=9) cout<<x<<"0"<<y<<z;

else if(z<=9&&y<=9) cout<<x<<"0"<<y<<"0"<<z;

    return 0;

}

我要回答