caixukun_ikun @ 2023-09-22 23:35:25
#include<bits/stdc++.h>
//#define N 101
using namespace std;
int n,m,sum;
bool really(int a,int b,int c,int d,int e,int f,int g,int h){
int year=d+c*10+b*100+a*1000,month=f+e*10,day=h+10*g;
if(month>12||month==0||day>31||day==0){
return false;
}else{
if(year%4==0&&year%100!=0||year%400==0)
{
if(month==2&&day>29) return false;
}else{
if(month==2&&day>28) return false;
}
if(month==1&&day>31) return false;
if(month==3&&day>31) return false;
if(month==4&&day>30) return false;
if(month==5&&day>31) return false;
if(month==6&&day>30) return false;
if(month==7&&day>31) return false;
if(month==8&&day>31) return false;
if(month==9&&day>30) return false;
if(month==10&&day>31) return false;
if(month==11&&day>30) return false;
if(month==12&&day>31) return false;
}
}
int main(){
cin>>n>>m;
for(int i=n;i<=m;i++){
int a=i/10000000,b=i/1000000%10,c=i/100000%10,d=i/10000%10,e=i%10,f=i%100/10,g=i%1000/100,h=i%10000/1000;
if(a==e&&b==f&&c==g&&d==h){
if(really(a,b,c,d,h,g,f,e)){
sum++;
}
}
}
cout<<sum;
return 0;
}
有没有大佬帮帮我,awa
by Eliana @ 2023-10-03 16:43:53
.....我也是,9和10都TLE