| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 137650 | hjx21113233 | 18岁生日 | C++ | Accepted | 2 MS | 272 KB | 1037 | 2025-11-22 10:36:01 |
#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==29) cout<<-1<<endl; else cout<<s<<endl; } else cout<<s<<endl; } return 0; }