第一次写出来60行的代码

Posted heroliu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第一次写出来60行的代码相关的知识,希望对你有一定的参考价值。

 #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行的代码的主要内容,如果未能解决你的问题,请参考以下文章

写出PHP代码,判断成绩,变量$score,用if判断,分数小于60则输出不及格,大于60

如何提取 DataTables 中所选行的第一列?

第一次写代码总结

记一次HDFS配置被覆盖的修复步骤

代码规范如何写出好代码

第一次面试