結果

問題 No.653 E869120 and Lucky Numbers
ユーザー convexineq
提出日時 2021-03-12 21:04:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 679 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 62,080 KB
最終ジャッジ日時 2024-10-14 11:01:31
合計ジャッジ時間 2,709 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

def No():
    print("No")
    exit()

p = input()
c = 0
fin = 0
L = len(p)
for j in range(L)[::-1]:
    i = int(p[j])
    if c==0:
        if i == 6 or i == 7:
            fin = 1
            c = 0
        elif i == 2 or i == 3 or i == 4:
            if fin: No()
            c = 1
        else:
            No()
    elif c==1:
        if i==1:
            if j==0:
                c = 0
                break
            else:
                No()
        elif i == 7 or i == 8:
            fin = 1
            c = 0
        elif i == 3 or i == 4 or i == 5:
            if fin: No()
            c = 1
        else:
            No()

print("Yes" if c==0 else "No")
0