結果

問題 No.87 Advent Calendar Problem
コンテスト
ユーザー rlangevin
提出日時 2023-06-20 00:33:04
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 401 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 188 ms
コンパイル使用メモリ 84,992 KB
実行使用メモリ 59,648 KB
最終ジャッジ日時 2026-03-15 06:32:59
合計ジャッジ時間 2,076 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def f(n):
    now = 0
    cnt = 0
    for i in range(2015, 2015 + n):
        if i % 400 == 0:
            now += 366 % 7
        elif i % 100 == 0:
            now += 365 % 7
        elif i % 4 == 0:
            now += 366 % 7
        else:
            now += 365 % 7
        now %= 7
        cnt += int(now == 0) 
    return cnt

N = int(input())
N -= 2014
print(f(2800) * (N // 2800) + f(N % 2800))
0