资深光能
#include <bits/stdc++.h>
using namespace std;
int a,b,count1;
int fj1[10];
int y[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
void pd(int n)
{
if (n%4==0&&n%100!=0||n%400==0)
y[2]=29;
else y[2]=28;
return ;
}
void fj(int n)
{
int i=0;
while (n)
{
fj1[++i]=n%10;
n/=10;
}
}
bool hw()
{
int l=1,r=8;
while (l<=r)
{
if (fj1[l]!=fj1[r])
return 0;
l++,r--;
}
return 1;
}
int main ()
{
cin>>a>>b;
int n1=a/10000,n2=b/10000;
int y1=(a%10000)/100,y2=(b%10000)/100;
int r1=a%100,r2=b%100;
for (int i=n1;i<=n2;i++)
{
pd(i);
int cmp1,h1;
if (i==n1) cmp1=y1;
else cmp1=1;
if (i==n2) h1=y2;
else h1=12;
for (int j=cmp1;j<=h1;j++)
{
int cmp2,h2;
if (i==n1) cmp2=r1;
else cmp2=1;
if (i==n2&&j==y2) h2=r2;
else h2=y[j];
for (int k=cmp2;k<=h2;k++)
{
int ans1=i;
ans1=ans1*100+j;
ans1=ans1*100+k;
fj(ans1);
if (hw())
count1++;
}
}
}
cout<<count1;
return 0;
}
哪错了