結果
問題 | No.87 Advent Calendar Problem |
ユーザー |
![]() |
提出日時 | 2025-04-16 15:59:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 37 ms / 5,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 81,900 KB |
実行使用メモリ | 53,820 KB |
最終ジャッジ日時 | 2025-04-16 16:03:28 |
合計ジャッジ時間 | 2,390 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
def compute_cycle_count(): count = 0 for y in range(400): a = y + y // 4 - y // 100 if a % 7 == 3: count += 1 return count cycle_count = compute_cycle_count() n = int(input()) if n < 2015: print(0) else: start = 2015 end = n total_years = end - start + 1 full_cycles = total_years // 400 remaining = total_years % 400 count = full_cycles * cycle_count # Check remaining years for y in range(start + full_cycles * 400, end + 1): a = y + y // 4 - y // 100 + y // 400 if a % 7 == 3: count += 1 print(count)