mamingxiao @ 2020-10-17 22:01:54
为什么错了
#include<bits/stdc++.h>
using namespace std;
int mark(int x)
{
int y=x,z=0;
while(y!=0)
{
z=z*10+(y%10);
y=y/10;
}
if(z==x)
{
return 1;
}
return 0;
}
int main()
{
int n,m,w=0;
cin>>n>>m;
int nx,ny,nz,mx,my,mz,ax,ay,az,bx,by,bz;
nz=n%100;
n=n/100;
ny=n%100;
n=n/100;
ax=nx=n%10000;
n=n/10000;
mz=m%100;
m=m/100;
my=m%100;
m=m/100;
bx=mx=m%10000;
m=m/10000;
for(int j=ax;j<=bx;j++)
{
if(j==ax)
{
ay=ny;
by=12;
}
else
{
ay=1;
by=12;
}
if(j==ay)
{
ay=1;
by=my;
}
else
{
ay=1;
by=12;
}
for(int i=ay;i<=by;i++)
{
if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
{
az=1;
bz=31;
}
if(i==4||i==6||i==7||i==8||i==9||i==11)
{
az=1;
bz=30;
}
if(i==2)
{
if((j%400==0)||(j%4==0&&j%100!=0))
{
az=1;
bz=29;
}
else
{
az=1;
bz=28;
}
}
if(i==ax&&i==ay)
{
az=nz;
}
if(i==bx&&i==by)
{
bz=mz;
}
for(int k=az;k<=bz;k++)
{
if(mark(k+i*100+j*10000))
{
w++;
}
}
}
}
cout<<w<<endl;
return 0;
}