wangzl @ 2021-10-22 20:21:40
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<stack>
#include<queue>
#include<set>
#include<iomanip>
#include<vector>
#include<algorithm>
using namespace std;
const int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
struct date {
int data, year;
};
date data1, data2;
int ans;
int main()
{
scanf("%d%d", &data1.data, &data2.data);
data1.year = data1.data / 10000,
data2.year = data2.data / 10000;
for(int i = data1.year; i <= data2.year; ++i) {
int newmonth = i % 100 / 10 + i % 10 * 10,
newday = i / 100 % 10 * 10 + i / 1000;
if(i * 10000 + newmonth * 100 + newday < data1.data ||
i * 10000 + newmonth * 100 + newday > data2.data) continue;
if(newmonth >= 1 && newmonth <= 12) {
if((i % 4 == 0 && i % 100 != 0) || (i % 400 == 0)) {
if(newday >= 1 && newday <= 29) ++ans;
}
else {
if(newday >= 1 && newday <= month[newmonth]) ++ans;
}
}
}
printf("%d", ans);
return 0;
}