标签:代码 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