Run ID:163038

提交时间:2026-10-24 11:32:19

#include <bits/stdc++.h> using namespace std; bool run(int n){ if ((n%4==0 && n%100!=0) || n%400==0){ return 1; } return 0; } int main() { int T; cin>>T; int year,moth,date; while (T--){ int sumi=0; //代表总天数 char c; cin>>year>>c>>moth>>c>>date; if (run(year) && moth==2 && date==29){ cout<<-1<<'\n'; continue; } for (int i=year;i<year+18;i++){ if (moth<3){ if (run(i)) sumi+=366; else sumi+=365; } else { if (run(i+1)) sumi+=366; else sumi+=365; } } cout<<sumi<<'\n'; } return 0; }