#include <iostream>//计算两个日期相对于0000 00 00的差值 using namespace std; int m[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; struct date { int year; int month; int day; }; void cal(date& d, string s) { d.day = 0; d.month = 0; d.year = 0; for (int i = 0; i < s.size(); i++) { if (i < 4) { d.year = d.year * 10 + s[i] - '0'; } else if (i >= 4 && i < 6) { d.month = d.month * 10 + s[i] - '0'; } else { d.day = d.day * 10 + s[i] - '0'; } } } int r(int y) { if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)) { return 1; } else { return 0; } } int cou(date& d) { int ans = d.day; for (int i = 0; i < d.year; i++) { if (r(i) == 1) { ans += 366; } else { ans += 365; } } if (r(d.year) == 1 && d.month > 2) { ans++; } for (int i = 0; i < d.month - 1; i++) { ans += m[i]; } return ans; } int main() { string s1, s2; while (cin >> s1 >> s2) { // 注意 while 处理多个 case date d1, d2; if (s1 > s2) { swap(s1, s2); } cal(d1, s1); cal(d2, s2); int day1 = cou(d1); int day2 = cou(d2); cout << day2 - day1 + 1 << endl; } } // 64 位输出请用 printf("%lld")