违规用户名J3c#3U1x @ 2023-08-16 16:11:05
#include <iostream>
using namespace std;
/*
Happy.Sun
*/
int n;
int m;
int month[13]={0,31,30,31,30,31,30,31,31,30,31,30,31};
int ans=0;
bool huiwen(int n){
int y=n;
int temp=0;
while(y){
temp*=10;
temp+=y%10;
y/=10;
}
if(temp==n) return 1;
else return 0;
}
int main(){
cin>>n>>m;
for(int i=n;i<=m;i++){
if(!huiwen(i)) continue;
int temp=i;
int m=temp/100%100;
if(m<=12&&month[m]>=temp%100){
ans++;
}
}
cout<<ans;
return 0;
}
by C202301 @ 2023-08-16 16:18:45
这样会不会TLE 应该枚举每年的回文数再判断这个回文数的日期是否真实
by ABCgfed @ 2023-08-16 20:04:23
@Happy_Sun 二月份是28/29天吧
by huang_rijin @ 2023-08-24 22:00:08
开O2