| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 158760 | 格林老师 | 18岁生日 | C++ | Accepted | 1 MS | 264 KB | 768 | 2026-08-22 17:07:10 |
#include <bits/stdc++.h> using namespace std; bool run(int y){ if ((y%4==0 && y%100!=0) || y%400==0){ return 1; } return 0; } int main() { int T; cin>>T; while(T--){ int year,month,date; char c; cin>>year>>c>>month>>c>>date; if (!run(year+18) && month==2 && date==29){ cout<<-1<<"\n"; continue; } int days=0; for (int i=year;i<year+18;i++){ if (month<=2 && run(i)){ days+=366; } else if (run(i+1) && month>2){ days+=366; } else{ days+=365; } } cout<<days<<"\n"; } return 0; }