結果
| 問題 | No.3402 [Cherry Anniversary 5] Beyond Zelkova, the 5th year vista seen through the bloom of a cherry bloosom |
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2025-12-06 19:10:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 2,000 ms |
| コード長 | 1,406 bytes |
| 記録 | |
| コンパイル時間 | 1,950 ms |
| コンパイル使用メモリ | 196,000 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-08 23:30:21 |
| 合計ジャッジ時間 | 3,953 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 24 |
ソースコード
#include"bits/stdc++.h"
using namespace std;
bool is_leap(int y) {
if (y % 100 == 0) { return y % 400 == 0; }
return y % 4 == 0;
}
int days_in_month(int year, int month) {
if (month == 2) {
return is_leap(year) ? 29 : 28;
}
return (month == 4 || month == 6 || month == 9 || month == 11) ? 30 : 31;
}
int get_total_days_from_19611231(int year, int month, int day) {
int total_days = 0;
// I: 1962 年から (year - 1) 年まで
for (int y = 1962; y < year; y++) {
total_days += is_leap(y) ? 366 : 365;
}
// II: year 年 1 月から year 年 (month - 1) 月まで
for (int m = 1; m < month; m++) {
total_days += days_in_month(year, m);
}
/// III: year 年 month 月の day 日間
total_days += day;
return total_days;
}
int main() {
int ys, ms, ds, ye, me, de;
cin >> ys >> ms >> ds;
cin >> ye >> me >> de;
int N_s = get_total_days_from_19611231(ys, ms, ds);
int N_e = get_total_days_from_19611231(ye, me, de);
int b = N_e - N_s + 1;
int Q; cin >> Q;
for (int q = 1; q <= Q; q++) {
int y, m, d;
cin >> y >> m >> d;
int N_q = get_total_days_from_19611231(y, m, d);
int a = N_q - (N_e + 1) + 1;
if (a < b) { cout << "Less" << endl; }
if (a == b) { cout << "Same" << endl; }
if (a > b) { cout << "More" << endl; }
}
}
Kazun