結果

問題 No.653 E869120 and Lucky Numbers
ユーザー titia
提出日時 2024-07-05 05:06:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-05 05:06:41
合計ジャッジ時間 2,345 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

S=list(input().strip())

S.reverse()
while S:
    if S and S[-1]=="6" or S[-1]=="7":
        S.pop()
    else:
        break

if len(S)==0:
    print("Yes")
    exit()

while S:
    if len(S)==1:
        print("No")
        exit()
    x=S.pop()
    y=S.pop()

    if x=="1" and y=="2":
        continue

    if x=="1" and (y=="3" or y=="4"):
        if S:
            S.append("1")
            continue
        else:
            continue

    if x=="1" and y=="5":
        S.append("1")
        continue

    print("No")
    exit()

print("Yes")

    
0