Run ID:113301
提交时间:2025-03-15 16:40:36
#include <bits/stdc++.h> #include <stdio.h> using namespace std; int main() { int T; cin >> T; while(T--){ int y; int m; int d; scanf("%d-%d-%d", &y, &m, &d); if((y % 4 == 0 && y % 100 != 0 || y % 400 == 0) && m == 2 && d == 29) cout << -1 << endl; else { int ans = 0; int f = 0; if(y % 4 == 0 && y % 100 != 0 || y % 400 == 0) f = 1; for(int i = 1; i <= 18; ++i) { int Y = y + i; if(Y % 4 == 0 && Y % 100 != 0 || Y % 400 == 0) { if(m > 2) ans = ans + 366; else ans = ans + 365; f = 1; } else { if(f == 1) { if(m <= 2) ans = ans + 366; else ans = ans + 365; f = 0; } else ans = ans + 365; } } cout << ans << endl; } } return 0; }