| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 147915 | 伊建润 | 18岁生日 | C++ | Accepted | 0 MS | 268 KB | 809 | 2026-02-09 08:36:15 |
#include <iostream> #include <sstream> #include <string> using namespace std; bool isLeapYear(int year) { return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0); } int main() { int T; cin >> T; while (T--) { string dateStr; cin >> dateStr; stringstream ss(dateStr); int year, month, day; char dash1, dash2; ss >> year >> dash1 >> month >> dash2 >> day; int sum = 0; if (month == 2 && day == 29) { cout << -1 << endl; } else { int startYear = (month > 2)? year + 1 : year; for (int i = 0; i < 18; i++) { sum += isLeapYear(startYear + i)? 366 : 365; } cout << sum << endl; } } return 0; }