| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 148791 | 杨润东 | 小明养猪的故事 | C++ | Wrong Answer | 0 MS | 272 KB | 842 | 2026-02-28 19:48:36 |
#include <iostream> #include <cstdio> using namespace std; long long julianDay(int year, int month, int day) { if (month <= 2) { year--; month += 12; } long long a = year / 100; long long b = a / 4; long long c = 2 - a + b; long long e = static_cast<long long>(365.25 * (year + 4716)); long long f = static_cast<long long>(30.6001 * (month + 1)); return c + day + e + f - 1524; } int main() { int T; cin >> T; while (T--) { int y, m, d; scanf("%d-%d-%d", &y, &m, &d); if (m == 2 && d == 29) { cout << -1 << '\n'; continue; } long long birth = julianDay(y, m, d); long long eighteen = julianDay(y + 18, m, d); cout << eighteen - birth << '\n'; } return 0; }
------Input------
17 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
------Answer-----
1 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
------Your output-----
6574 6574 6574 6575 6575 6574 6574 6575 6575 6574 6574 6575 6575 6574 6574 6575 6575