結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー lloyzlloyz
提出日時 2023-12-01 23:35:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 1,135 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2023-12-01 23:35:57
合計ジャッジ時間 2,492 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 48 ms
53,460 KB
testcase_12 AC 37 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 38 ms
53,460 KB
testcase_15 AC 37 ms
53,460 KB
testcase_16 AC 38 ms
53,460 KB
testcase_17 AC 37 ms
53,456 KB
testcase_18 AC 37 ms
53,460 KB
testcase_19 AC 37 ms
53,460 KB
testcase_20 AC 37 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
days_leap = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def is_leap_year(y):  # 閏年判定
    if y%400==0: return True
    elif y%100==0: return False
    elif y%4==0: return True
    else: return False
def zeller(y, m, d):  # ツェラーの公式
    # 土曜日 -> 0
    if m<=2:
        m += 12
        y -= 1
    C, Y = divmod(y, 100)
    h = (d + 26*(m+1)//10 + Y + Y//4 + (-2*C+C//4)) % 7
    return h
def md2d(m, d):  # m 月 d 日は 0-indexed で何日目か?
    # 返り値は [0, 365)
    return sum(days[:m]) + d - 1
def all_md():
    for m, ds in enumerate(days[1:], 1):
        for d in range(1, ds+1):
            yield m, d
def all_ymd(y_start, y_end):
    for y in range(y_start, y_end):
        for m, d in all_md(days=days_leap if is_leap_year(y) else days):
            yield y, m, d

y, m, d = map(int, input().split('/'))

d += 2
if is_leap_year(y):
    if d > days_leap[m]:
        d -= days_leap[m]
        m += 1
else:
    if d > days[m]:
        d -= days[m]
        m += 1
if m == 13:
    m = 1
    y += 1
print(f"{y}/{m:02}/{d:02}")
0