#include<bits/stdc++.h>
using namespace std;
int s=0;
bool hw(int x[]){
int i=0,j=7;
while(j>i){
if(x[i]!=x[j])
return false;
i++;
j--;
}
return true;
}
bool rn(int x){
if(x%4==0&&x%100!=0||x%400==0)
return true;
return false;
}
bool f(int x[]){
int year=x[0]*1000+x[1]*100+x[2]*10+x[3],m=x[4]*10+x[5],d=x[6]*10+x[7];
if(m>12||m==0)
return false;
if(d>31)
return false;
if(m==2){
if(rn(year)&&d>29)
return false;
if(!rn(year)&&d>28)
return false;
}
if(m==9||m==4||m==6||m==11)
if(d>30)
return false;
if(hw(x)){
s++;
return true;
}
return false;
}
int main(){
int a,b;
cin>>a>>b;
for(int i=a;i<=b;i++){
int j=7,k=i,c[8];
while(k!=0){
c[j--]=k%10;
k/=10;
}
f(c);
}
cout<<s;
return 0;
}
全部评论
(0) 回帖