回文日期:回文日期
//找到一个年份,倒序输出符合条件就行
#include<iostream>
using namespace std;
string tmp1,tmp2;
int mx=0;
int flag1=1,flag2=0;
bool is(int n){int date[20]={0,31,28,31,30,31,30,31,31,30,31,30,31};int day=n%100;int mon=(n%10000)/100;int year=n/10000;if((year%4==0&&year%100!=0)||year%400==0){date[2]=29;}if(mon>0&&mon<=12&&day>0&&day<=date[mon]){return true;}return false;
}
int main(){int n;//输入日期cin>>n;while(n++){if(!is(n))continue;//日期是否合法string st1="";//初始化字符串储int temp=n;while(temp){//转化为字符串st1+=(temp%10)+'0';temp/=10;}flag1=1;
for(int i=0;i<st1.size()-1;i++){if(st1[i]!=st1[st1.size()-i-1]){flag1=0;//1第一个不成立break;}
}
if(flag1==1&&mx==0){//标记一次以后就不标记了tmp1=st1;mx=1;
}if(st1[0]==st1[2]&&st1[1]==st1[3]&&st1[4]==st1[6]&&st1[5]==st1[7]&&st1[3]==st1[4]&&st1[2]==st1[5]&&st1[0]!=st1[1]){flag2=1;tmp2=st1;}if(flag1==0&&flag2==1)break;}cout<<tmp1<<endl;cout<<tmp2<<endl;return 0;
}