guoyibo @ 2023-09-20 22:21:44
#include<bits/stdc++.h>
using namespace std;
int d1,d2,ans=0;
int nb[4] = {0};
int cnm(int n){
int a = n/1000 + n/100%10*10 + n/10%10*100 + n%10*1000;
nb[0] = a/1000;
nb[1] = a/100%10;
nb[2] = a/10%10;
nb[3] = a%10;
return a;
}
int main(){
cin>>d1>>d2;
int y1=d1/10000;
int y2=d2/10000;
for(int i=y1;i<=y2;i++){
int a = cnm(i);
int fuck = i*10000+a;
if(fuck >= d1 and fuck <= d2 and nb[0]*10 + nb[1] <=12){
if(nb[1] == 1 or nb[1] == 3 or nb[1] == 5 or nb[1] == 7 or nb[1] == 8 or (nb[0] == 1 and nb[1] == 0) or (nb[0] == 1 and nb[1] == 2)){
if(nb[2]*10+nb[3] <= 31){
ans++;
}
}
else if(nb[1] == 4 or nb[1] == 6 or nb[1] == 9 or (nb[0] == 1 and nb[1] == 1)){
if(nb[2]*10+nb[3] <= 30){
ans++;
}
}
else if(nb[1] == 2){
if((i%4 == 0 and i%100 != 0) or i%400==0){
if(nb[2]*10+nb[3] <= 29){
ans++;
}
}
else{
if(nb[2]*10+nb[3] <= 28){
ans++;
}
}
}
}
}
cout<<ans;
return 0;
}
可能有点乱 大佬见谅