結果
問題 | No.653 E869120 and Lucky Numbers |
ユーザー |
![]() |
提出日時 | 2024-07-05 05:12:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 946 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-05 05:12:59 |
合計ジャッジ時間 | 2,186 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 RE * 1 |
ソースコード
import sysinput = sys.stdin.readlineS=list(input().strip())S.reverse()while S:if S and S[-1]=="6":S.pop()if S[-1]=="1":print("No")exit()continueif S[-1]=="7":if len(S)==1:S.pop()continueif S[-2]=="6" or S[-2]=="7" or S[-2]=="8":S.pop()continueS.pop()S.append("1")breakif S[-1]=="8":S.pop()S.append("1")breakbreakif 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":continueif x=="1" and (y=="3" or y=="4"):if S:S.append("1")continueelse:continueif x=="1" and y=="5":S.append("1")continueprint("No")exit()print("Yes")