結果

問題 No.87 Advent Calendar Problem
コンテスト
ユーザー flippergo
提出日時 2026-09-10 15:00:04
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 27 ms / 5,000 ms
+ 665µs
コード長 530 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 74 ms
コンパイル使用メモリ 80,512 KB
実行使用メモリ 54,656 KB
最終ジャッジ日時 2026-09-10 15:00:07
合計ジャッジ時間 2,471 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
num = 1
cnt = 0
for y in range(2015,2413+1):
    if y%400==0:
        cnt += 2
    elif y%100==0:
        cnt += 1
    elif y%4==0:
        cnt += 2
    else:
        cnt += 1
    cnt = cnt%7
    if cnt==0:
        num += 1
q = (N-2014)//400
r = (N-2014)%400
ans = 0
cnt = 0
for y in range(2015,2014+r+1):
    if y%400==0:
        cnt += 2
    elif y%100==0:
        cnt += 1
    elif y%4==0:
        cnt += 2
    else:
        cnt += 1
    cnt = cnt%7
    if cnt==0:
        ans += 1
ans += num*q     
print(ans)
0