結果
| 問題 | No.653 E869120 and Lucky Numbers | 
| コンテスト | |
| ユーザー |  ntuda | 
| 提出日時 | 2025-08-16 12:46:24 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 613 bytes | 
| コンパイル時間 | 333 ms | 
| コンパイル使用メモリ | 82,700 KB | 
| 実行使用メモリ | 65,208 KB | 
| 最終ジャッジ日時 | 2025-08-16 12:46:28 | 
| 合計ジャッジ時間 | 2,983 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 WA * 2 | 
ソースコード
def yes():
    print("Yes")
    exit()
def no():
    print("No")
    exit()
P = input()
N = len(P)
if N == 1:
    no()
if int(P[N-1]) not in [2,3,4]:
    no()
st = 0
for i in reversed(range(N-1)):
    p = int(P[i])
    if st == 0:
        if p in [3,4,5]:
            continue
        elif p in [7,8]:
            if i == 0:
                yes()
            st = 1
        elif p == 1:
            if i == 0:
                yes()
            else:
                no()
        else:
            no()
    else:
        if p in [6,7]:
            if i == 0:
                yes()
        else:
            no()
            
            
            
        