#include <iostream> #include <functional> #include <iostream> using namespace std; int isPyear(int y){ return (y%4==0 && y%100!=0)||(y%400==0); } int main() { int daysEach[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}}; int d1,d2; cin>>d1>>d2; if(d1>d2){ int tem=d1; d1=d2; d2=tem; } int minus_day=(d2-d1)%100; if(minus_day>=70) minus_day=minus_day-100;//day of d2 is lower than that of d1 int minus_mon=(d2-d1)%10000/100; if(minus_mon>=89) minus_mon-=100; int d1_year=d1/10000; int d1_mon=d1/100%100; if(minus_mon<0){ int j=-minus_mon; while(j>0){ d1_mon--; minus_day-=daysEach[isPyear(d1_year)][d1_mon]; j--; } } else { while(minus_mon>0){ minus_day+=daysEach[isPyear(d1_year)][d1_mon]; minus_mon--; d1_mon--; } } int d2_year=d2/10000; int count=1; while(d1_year<d2_year){ if(isPyear(d1_year)) count+=366; else count+=365; d1_year++; } count+=minus_day; cout<<count; }