Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
163043 屠思宇 18岁生日 C++ Accepted 1 MS 272 KB 751 2026-10-24 11:36:02

Tests(1/1):


Code:

#include<iostream> 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,month,date; while (T--){ int sumi=0; char c; cin>>year>>c>>month>>c>>date; if (run(year) && month==2 && date==29){ cout<<-1<<endl; continue; } for (int i=year;i<year+18;i++){ if (month<3){ if (run(i)) sumi+=366; else sumi+=365; } else{ if (run(i+1)) sumi+=366; else sumi+=365; } } cout<<sumi<<endl; } return 0; }