ZhouZheyv @ 2023-11-12 17:24:50
#include<bits/stdc++.h>
using namespace std;
int a,b;
int cnt=0;
int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
struct date{
int look;
int year=look/10000;
int month=look/100%100;
int day=look%100;
}i;
bool isPalin(int n){
string s="",t="";
while(n){
s=s+(char)(n%10);
n/=10;
}
for(int i=s.size()-1;i>=0;i--){
t=t+s[i];
}
return (s==t);
}
void add(){
int line;
if(i.month==1 || i.month==3 || i.month==5 || i.month==7 || i.month==8 || i.month==10 || i.month==12){
line=31;
}else if(i.month==4 || i.month==6 || i.month==9 || i.month==11){
line=30;
}else{
if(i.year%4==0 && i.year%100!=0 || i.year%400==0){
line=29;
}else{
line=28;
}
}
if(++i.day>line){
i.day-=line;
if(i.month==12){
i.month==1;
i.year++;
}else{
i.month++;
}
}
i.look=(i.year*10000+i.month*100+i.day);
return;
}
int main(){
cin>>a>>b;
for(i.look=a;i.look<b;add()){
if(isPalin(i.look)){
cnt++;
}
}
cout<<cnt;
return 0;
}
注:本帖禁止发自己的AC代码。