| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 158695 | 王慕哲 | 18岁生日 | C++ | Wrong Answer | 1 MS | 268 KB | 847 | 2026-08-22 16:44:22 |
#include<bits/stdc++.h> using namespace std; bool r(int y){ if((y%4==0 && y%100!=0) || y%400){ return 1; } return 0; } int main(){ int T; cin>>T; while(T--){ int a,b,c; char f; cin>>a>>f>>b>>f>>c; if(!r(a+18) && b==2 && c==29){ cout<<-1<<endl; continue; } int d=0; for(int i=a;i<a+18;i++){ if(b<=2){ if(r(i)){ d+=366; } else{ d+=365; } } else{ if(r(i+1)){ d+=366; } else{ d+=365; } } } cout<<d<<endl; } return 0; }
------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-----
6587 6588 6588 6587 6588 6587 6588 6587 6588 6588 6587