LHY20221231 @ 2024-08-21 11:34:27
#include<iostream>
using namespace std;
int da1,da2,ans,hw[100];
bool bbb(int x){
int n=0,s=x;
while(s){
n=n*10+s%10;
s/=10;
}
if (n == x)
return true;
else
return false;
}
bool aaa(int x){
if((x%100!=0&&x%4==0)||x%400==0)
return true;
else
return false;
}
int main(){
cin>>da1>>da2;
for(int i=da1;i<=da2;i++){
if(bbb(i)){
ans++;
cout<<i<<endl<<endl;
}
//cout<<i<<endl;
int rq=i%100,nf=(i-i%10000)/10000,yf=(i-i%100-(i-i%10000))/100;
if(yf==1||yf==3||yf==5||yf==7||yf==8||yf==10||yf==12){
if(rq==31){
if(yf==12){
if(nf%10==9){
if((nf%100-nf%10)/10==9){
i+=1000100-991231;
}
else{
i+=100100-91231;
}
}
else{
i+=10100;
i-=1231;
}
}
else{
i+=100;
i-=30;
}
}
}
else if(yf==4||yf==6||yf==9||yf==11){
if(rq==30){
i+=100;
i-=30;
}
}
else if(yf==2) {
if(aaa(nf)){
if(rq==29){
i+=100;
i-=29;
}
}
else{
if(rq==28){
i+=100;
i-=28;
}
}
}
}
cout<<ans;
return 0;
}
by LHY20221231 @ 2024-08-21 14:30:52
A了,此贴结