题目描述
blablabla
样例
#include<iostream>
#include<cstdio>
using namespace std;
int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool check_valid(int n)
{
int year=n/1000;
int mon=n%10000/100;
int day=n%100;
if(mon<0||mon>12) return false;
if(day<0||day>days[mon]&&mon!=2) return false;
int x=0;
if(mon==2)
{
x=year%4==0&&year%100==0||year%400==0;
}
if(day>days[mon]+x) return false;
return true;
}
int main()
{
int date1,date2,res=0;
cin>>date1>>date2;
for(int i=1000;i<10000;i++)
{
int x=i,t=i;
for(int j=0;j<4;j++)
x=x*10+t%10,t/=10;
if(date1<=x&&date2>=x&&check_valid(x)) res++;
}
cout<<res<<endl;
return 0;
}