wuhaoran2012 @ 2023-09-29 18:32:40
#include<bits/stdc++.h>
using namespace std;
bool check(long long x){
string str=to_string(x);
for(int i=0;i<=3;i++){
if(str[i]!=str[7-i]) return 0;
}
return 1;
}
long long lnm[] {2,4,6,9,11};
long long a,b,ans;
int main(){
cin>>a>>b;
for(long long i=a;i<=b;i++){
long long month=(i/100)%100,day=i%100,year=i/10000;
if(month>12||day>32) continue;
bool ok=1;
for(auto j:lnm){
if(month==j&&day>30){
ok=0;break;
}
}
if(!ok) continue;
if(month==2&&!((year%4==0&&year%100)|(year%400!=0))
&&day>28) continue;
ans+=check(i);
}
cout<<ans;
return 0;
}
by danzai10 @ 2023-10-05 21:11:37
#include<bits/stdc++.h>
using namespace std;
int month[15]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int x,y,sum;int main(){
cin>>x>>y;
for(int i=1;i<=12;i++){
for(int j=1;j<=month[i];j++){
int k=j%10*1000+(j/10)*100+(i%10)*10+(i/10);
k=k*10000+i*100+j;
if(k>=x&&k<=y){
sum++;
}
}
}
cout<<sum;
return 0;
}