Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
137660 hjx21113233 18岁生日 C++ Wrong Answer 2 MS 284 KB 1037 2025-11-22 10:52:10

Tests(0/1):


Code:

#include <bits/stdc++.h> using namespace std; int main() { int c,d,i,j,k,n,t,s,temp,b[12]={31,28,31,30,31,30,31,31,30,31,30,31}; string a; cin>>t; getline(cin,a); while (t--) { s=0; getline(cin,a); i=(a[0]-'0')*1000+(a[1]-'0')*100+(a[2]-'0')*10+(a[3]-'0'); j=(a[5]-'0')*10+a[6]-'0'; k=(a[8]-'0')*10+a[9]-'0'; c=j; d=12; if (i%400==0 and i%100==0 or i%4==0 and i%100!=0) b[1]=29; else b[1]=28; j=j-1; s=s+b[j]-k; while (j+1<12) { s=s+b[j+1]; j++; } n=1; i=i+1; while (n<=18) { if (i%400==0 and i%100==0 or i%4==0 and i%100!=0) { temp=1; b[1]=29; } else { temp=0; b[1]=28; } if (n==18) d=c; j=0; while (j<d) { s=s+b[j]; j++; } if (n==18) s=s-(b[j-1]-k); i++; n++; } if (temp==0) { if (c==2 and k==28) cout<<-1<<endl; else cout<<s<<endl; } else cout<<s<<endl; } return 0; }


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-----
6574 6575 6575 6575 -1 6575 6574 -1 6575 -1 6575