Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
163038 格林老师 18岁生日 C++ Accepted 2 MS 264 KB 768 2026-10-24 11:32:19

Tests(1/1):


Code:

#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; }