xiao__ @ 2023-10-18 21:49:00
#include<bits/stdc++.h>//pal
#define int long long
using namespace std;
int n1,n2,y11,y2,t1,t2,cnt=0;
char a,b,c,d,e,f,g,h;
int my[20]{0,31,-1,31,30,31,30,31,31,30,31,30,31};
bool check1(int x){
if(x%4==0&&x%100!=0) return 1;
else if(x%400==0) return 1;
else return 0;
}
bool check2(int x){
int num=0,T=x;
while(x){
num=num*10+x%10;
x/=10;
}
if(num==T) return true;
else return false;
}
int pj(int x,int y,int z){
int ans=0;
ans+=x;
ans*=100;
ans+=y;
ans*=100;
ans+=z;
return ans;
}
signed main(){
freopen("pal.in","r",stdin);
freopen("pal.out","w",stdout);
cin>>a>>b>>c>>d>>e>>f>>g>>h;
n1=((a-'0')*1000+(b-'0')*100+(c-'0')*10+(d-'0'));
y11=((e-'0')*10+(f-'0'));
t1=((g-'0')*10+(h-'0'));
cin>>a>>b>>c>>d>>e>>f>>g>>h;
n2=((a-'0')*1000+(b-'0')*100+(c-'0')*10+(d-'0'));
y2=((e-'0')*10+(f-'0'));
t2=((g-'0')*10+(h-'0'));
//cout<<n1<<" "<<n2<<" "<<y11<<" "<<y2<<" "<<t1<<" "<<t2<<"\n";
for(int i=n1;i<=n2;){
for(int j=y11;;){
if(j==13){
j=1;
i++;
}
if(j==2) my[2]=check1(i)?29:28;
for(int k=t1;;k++){
if(i==n2&&j==y2&&k==t2){
cout<<cnt;
return 0;
}
if(k>my[j]){
j++;
k=1;
break;
}
if(check2(pj(i,j,k))){
cnt++;
}
}
}
}
return 0;
}
by xiao__ @ 2023-10-18 21:50:21
不用管freopen
by lirenzehao @ 2023-10-18 21:52:25
@chatGPT_ y2也是关键词
by xiao__ @ 2023-10-18 22:00:06
烦死了啊..........