码迷,mamicode.com
首页 > 其他好文 > 详细

第一次写出来60行的代码

时间:2018-08-16 19:43:14      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:代码   clu   cout   lse   iostream   using   return   str   cin   

 #include<iostream>

using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a%100==0&&a%400==0&&b==2&&c==29){
        cout<<a<<" "<<b<<" "<<28<<endl;
        cout<<a<<" "<<3<<" "<<1<<endl;
    }else if(a%100!=0&&a%4==0&&b==2&&c==29){
        cout<<a<<" "<<b<<" "<<28<<endl;
        cout<<a<<" "<<3<<" "<<1<<endl;
    }else if(a%100==0&&a%400==0&&b==2&&c==1){
        cout<<a<<" "<<1<<" "<<31<<endl;
        cout<<a<<" "<<2<<" "<<2<<endl;
    }else if(a%100!=0&&a%4==0&&b==2&&c==1){
        cout<<a<<" "<<1<<" "<<31<<endl;
        cout<<a<<" "<<2<<" "<<2<<endl;
    }if((b==1||b==3||b==5||b==7||b==8||b==10)&&(c==31)){
        cout<<a<<" "<<b<<" "<<30<<endl;
        cout<<a<<" "<<b+1<<" "<<1<<endl;
    }else if((b==5||b==7||b==8||b==10||b==12)&&(c==1)){
        cout<<a<<" "<<b-1<<" "<<30<<endl;
        cout<<a <<" "<<b <<" "<<2<<endl;
    }else if((b==1)&&(c==1)){
        cout<<a-1<<" "<<12<<" "<<31<<endl;
        cout<<a<<" "<<1<<" "<<2<<endl;
    }else if(b==3&&c==1){
        if((a%100!=0&&a%4==0)||(a%100==0&&a%400==0)){
            cout<<a<<" "<<2<<" "<<29<<endl;
            cout<<a<<" "<<3<<" "<<2<<endl;
        }else {
            cout<<a<<" "<<2<<" "<<28<<endl;
            cout<<a<<" "<<3<<" "<<2<<endl;
        }
    }if((b==4||b==6||b==9||b==11)&&(c==1)){
        cout<<a<<" "<<b-1<<" "<<31<<endl;
        cout<<a<<" "<<b<<" "<<2<<endl;
    }else if((b==4||b==6||b==9||b==11)&&(c==30)){
        cout<<a<<" "<<b<<" "<<29<<endl;
        cout<<a<<" "<<b<<" "<<1<<endl;
    }else if(b==12&&c==31){
        cout<<a<<" "<<12<<" "<<30<<endl;
        cout<<a+1<<" "<<1<<" "<<1<<endl;
    }else if((b==1||b==3||b==5||b==7||b==8||b==10||b==12)&&(c>1&&c<31)){
        cout<<a<<" "<<b<<" "<<c-1<<endl;
        cout<<a<<" "<<b<<" "<<c+1<<endl;
    }else if((b==4||b==6||b==9||b==11)&&(c>1&&c<30)){
        cout<<a<<" "<<b<<" "<<c-1<<endl;
        cout<<a<<" "<<b<<" "<<c+1<<endl;
    }else if(((a%100!=0&&a%4==0)||(a%100==0&&a%400==0))&&(b==2)&&(c<29&&c>1)){
        cout<<a<<" "<<b<<" "<<c-1<<endl;
        cout<<a<<" "<<b<<" "<<c+1<<endl;
    }else if(((a%100!=0&&a%4!=0)||(a%100==0&&a%400!=0))&&(b==2)&&(c>1&&c<28)){
        cout<<a<<" "<<b<<" "<<c-1<<endl;
        cout<<a<<" "<<b<<" "<<c+1<<endl;
    }else if(((a%100!=0&&a%4!=0)||(a%100==0&&a%400!=0))&&(b==2)&&(c==28)){
        cout<<a<<" "<<b<<" "<<27<<endl;
        cout<<a<<" "<<3<<" "<<1<<endl;
    }
    return 0;
}

第一次写出来60行的代码

标签:代码   clu   cout   lse   iostream   using   return   str   cin   

原文地址:https://www.cnblogs.com/heroliu/p/9488650.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!