82分代码:
#include<bits/stdc++.h>
using namespace std;
int a,b,ans;
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int huiwen(int x){
int xh=0,xz=0,t=0;
xz=x;
while(t<=7){
xh=xh*10+x%10;
x=x/10;
t++;
}
if(xh==xz){
return 1;
}
return 0;
}
int possible(int x){
int year,mouth,day;
year=x/10000;
mouth=x%10000/100;
day=x%100;
if((year%4==0&&year%100!=0||year%400==0)&&mouth==2){
if(day<=29){
return 1;
}
else{
return 0;
}
}
else{
if(mouth<=12){
if(day<=m[mouth]){
return 1;
}
else{
return 0;
}
}
else{
return 0;
}
}
}
int main(){
cin >> a >> b;
for(int i=a;i<=b;i++){
if(huiwen(i)&&possible(i)){
ans++;
}
}
cout << ans;
return 0;
}
开02就AC了!!!
离谱!!!