Naruto_steven @ 2018-11-04 22:25:22
//20000101
//cdefghkq
//20101231
/*20000101
20101231*/
#include<iostream>
using namespace std;
#define ll long long
int r[14]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int y[14]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
ll a,b,ans;
cin>>a>>b;
for(ll i=a;i<=b;i++){
int c=i/10000000;
int d=(i%10000000)/1000000;
int e=(i%1000000)/100000;
int f=(i%100000)/10000;
int g=(i%10000)/1000;
int h=(i%1000)/100;
int k=(i%100)/10;
int q=i%10;
if(((c*1000+d*100+e*10+f)%4==0&&(c*1000+d*100+e*10+f)%100!=0)||((c*1000+d*100+e*10+f)%400==0)){
if((g*10+h)>12||(k*10+q>y[g*10+h])){
continue;
}else{
if(c==q&&d==k&&e==h&&f==g) ans++;;
}
}else{
if((g*10+h)>12||(k*10+q>r[g*10+h])){
continue;
}else{
if(c==q&&d==k&&e==h&&f==g) ans++;
}
}
}
cout<<ans-1;
return 0;
}
//c==q&&d==k&&e==h&&f==g
by tido @ 2018-11-08 21:34:18
using namespace std;
string s1,s2;
int hmday[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
freopen("date.in","r",stdin);
freopen("date.out","w",stdout);
cin>>s1>>s2;
if(s1==s2)
{
int t=1;
for(int i=0,j=s1.length()-1;i<s1.length();i++,j--)
if(s1[i]!=s2[j])
{
t=0;
break;
}
if(t==1)
{
cout<<1;
return 0;
}
else
{
cout<<0;
return 0;
}
}
int startyear,endyear;
startyear=(s1[0]-'0')*1000+(s1[1]-'0')*100+(s1[2]-'0')*10+s1[3]-'0';
endyear=(s2[0]-'0')*1000+(s2[1]-'0')*100+(s2[2]-'0')*10+s2[3]-'0';
int smonth,emonth,sday,eday;
smonth=(s1[4]-'0')*10+s1[5]-'0';
sday=(s1[6]-'0')*10+s1[7]-'0';
emonth=(s2[4]-'0')*10+s2[5]-'0';
eday=(s2[6]-'0')*10+s2[7]-'0';
int startmonth,endmonth,startday,endday;
startmonth=(s1[3]-'0')*10+s1[2]-'0';
startday=(s1[1]-'0')*10+s1[0]-'0';
endmonth=(s2[3]-'0')*10+s2[2]-'0';
endday=(s2[1]-'0')*10+s2[0]-'0';
if(startmonth<smonth||startmonth>=smonth&&startday<sday)
startyear++;
if(endmonth>emonth||endmonth<=emonth&&endday>eday)
endyear--;
int ans=0;
for(int i=startyear;i<=endyear;i++)
{
int month=0,day=0,ii=i;
month+=ii%10*10;ii/=10;
month+=ii%10;ii/=10;
day+=ii%10*10;ii/=10;
day+=ii%10;ii/=10;
if(month>=1&&month<=12)
{
if(month!=2&&day>=1&&day<=hmday[month])
ans++;
if(month==2)
{
if(i%4==0&&i%100!=0&&day>=1&&day<=29)
ans++;
else if(i%400==0&&day>=1&&day<=29)
ans++;
else if(day>=1&&day<=28)
ans++;
}
}
}
cout<<ans;
fclose(stdin);
fclose(stdout);
}