#include <iostream> #include<string> using namespace std; int mo1[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}; int mo2[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int main() { string s1,s2; int y1=0,y2=0,m1=0,m2=0,d1=0,d2=0; cin>>s1; cin>>s2; for(int i =0;i<=3;i++)//获取输入的年月日 { char c1 = s1[i]; char c2 = s2[i]; y1 = y1*10+(c1 - '0'); y2 = y2*10+(c2 - '0'); // cout<<c1-'0'; } for(int i =4;i<=5;i++) { char c1 = s1[i]; m1 =m1*10+ (c1 - '0'); char c2 = s2[i]; m2 =m2*10+ (c2 - '0'); } for(int i =6;i<=7;i++) { char c1 = s1[i]; d1 =d1*10+ (c1 - '0'); char c2 = s2[i]; d2 =d2*10+(c2 - '0'); } // cout<<y1<<" "<<m1<<" "<<d1<<endl; int cnt1=0,cnt2=0; if((y1%4==0&&y1%100!=0)||(y1%400==0)) { for(int i=1;i<m1;i++) { cnt1 += mo1[i]; } cnt1 +=d1; } else{ for(int i=1;i<m1;i++) { cnt1 += mo2[i]; } cnt1 +=d1; } if((y2%4==0&&y2%100!=0)||(y2%400==0)) { for(int i=1;i<m2;i++) { cnt2 += mo1[i]; } cnt2 +=d2; } else{ for(int i=1;i<m2;i++) { cnt2 += mo2[i]; } cnt2 +=d2; } int ans =0; if(y1==y2) { if(cnt1>cnt2) { ans = cnt1-cnt2; cout<<ans<<endl; } else { ans =cnt2-cnt1+1; cout<<ans<<endl;; } } else if(y1>y2){ while(y1>y2) { if((y2%4==0&&y2%100!=0)||(y2%400==0)) { ans +=366; } else ans+=365; y2++; } cout<<ans+cnt1-cnt2+1; } else if(y1<y2){ while(y1<y2) { if((y1%4==0&&y1%100!=0)||(y1%400==0)) { ans +=366; } else ans+=365; y1++; } cout<<ans+cnt2-cnt1+1;//计算差额 } } // 64 位输出请用 printf("%lld")