結果

問題 No.653 E869120 and Lucky Numbers
コンテスト
ユーザー rin204
提出日時 2022-10-30 16:52:16
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 478 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 126 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 68,096 KB
最終ジャッジ日時 2026-04-04 06:57:34
合計ジャッジ時間 1,888 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

S = list(map(int, input()))[::-1]
t = 2
n = len(S)
S += [0, 0, 0, 0]
for i in range(n):
    if S[i] == 0:
        break
    elif S[i] in [2, 3, 4]:
        if t == 1:
            print("No")
            exit()
        S[i] = 0
        S[i + 1] -= 1
    elif S[i] in [6, 7]:
        if i == 0:
            print("No")
            exit()
        t = 1
        S[i] = 0
    else:
        print("No")
        exit()

if all(s == 0 for s in S):
    print("Yes")
else:
    print("No")
0