提交时间:2025-01-24 14:42:50
运行 ID: 5244
#include <bits/stdc++.h> using namespace std; bool year(int n) { if(n % 400 == 0 || (n % 4 == 0 && n % 100 != 0)) { return true; } else { return false; } } int main() { int nn,yy,rr; char g1,g2; int n; cin>>n; for(int i = 0;i < n;i++) { int temp = 0; cin>>nn>>g1>>yy>>g2>>rr; if(yy == 2 && rr == 29) { cout<<-1<<endl; continue; } nn++; int NN = nn + 17; for(int j = nn;j <= NN;j++) { if(year(j)) { temp += 366; } else { temp += 365; } } cout<<temp<<endl; } return 0; }