8bit_Stella @ 2023-04-14 19:16:59
#include<iostream>
#include<stdio.h>
using namespace std;
long long d1,d2,ans=0;
int m1[15]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int m2[15]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
scanf("%ld %ld",&d1,&d2);
int a=d1/10000,b=d2/10000;
int ma=(a%10)*10+(a/10)%10;
int mb=(b%10)*10+(b/10)%10;
for(int i=a;i<=b;i++){
if(i==1311||i==1320||i==1340||i==1360||i==1390) continue;
int month=(i%10)*10+(i/10)%10;
int day=((i/100)%10)*10+i/1000;
if(month<1||month>12||day<1||day>31) continue;
if(i==a&&month<ma) continue;
if(i==b&&month>mb) continue;
if((i%4==0&&i%100!=0)||(i%400==1)){
if(day<=m2[month]) ans++;
}else{
if(day<=m1[month]) ans++;
}
}
cout<<ans;
return 0;
}