結果
| 問題 | No.653 E869120 and Lucky Numbers | 
| コンテスト | |
| ユーザー |  ntuda | 
| 提出日時 | 2025-08-16 12:51:37 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 46 ms / 2,000 ms | 
| コード長 | 618 bytes | 
| コンパイル時間 | 238 ms | 
| コンパイル使用メモリ | 82,668 KB | 
| 実行使用メモリ | 66,100 KB | 
| 最終ジャッジ日時 | 2025-08-16 12:51:40 | 
| 合計ジャッジ時間 | 2,793 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 31 | 
ソースコード
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()
no()
            
            
            
        