Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158744 郦辰希 18岁生日 C++ Wrong Answer 1 MS 264 KB 769 2026-08-22 16:58:03

Tests(0/1):


Code:

#include<bits/stdc++.h> using namespace std; bool run(int y){ if(y%400==0 || (y%100==0 && y%4==0)){ return 1; } return 0; } int main(){ int year,month,date,days=0,T; cin>>T; char a; a='-'; for(int i=1;i<=T;i++){ days=0; cin>>year>>a>>month>>a>>date; if(!run(year+18) && month==2 && date==29){ cout<<-1<<"\n"; continue; } for(int x=year;x<year+18;x++){ if(run(x) && month<=2){ days+=366; } else if(run(x+1) && month>2){ days+=366; } else{ days+=365; } } cout<<days<<endl; } }


Run Info:

------Input------
11 1989-11-26 1962-12-02 1963-03-27 1990-03-31 1900-02-28 2000-02-29 2008-08-08 1995-02-28 2012-02-29 2020-02-28 1982-03-01
------Answer-----
6574 6575 6575 6575 6574 -1 6574 6575 -1 6575 6575
------Your output-----
6571 6570 6570 6571 6571 -1 6570 6571 -1 6570 6571