結果
| 問題 | No.87 Advent Calendar Problem | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-04-15 23:07:22 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 33 ms / 5,000 ms | 
| コード長 | 615 bytes | 
| コンパイル時間 | 287 ms | 
| コンパイル使用メモリ | 82,352 KB | 
| 実行使用メモリ | 53,504 KB | 
| 最終ジャッジ日時 | 2025-04-15 23:09:40 | 
| 合計ジャッジ時間 | 1,936 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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)
            
            
            
        