結果

問題 No.653 E869120 and Lucky Numbers
ユーザー Ryuto
提出日時 2018-03-19 17:32:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 915 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 65,232 KB
最終ジャッジ日時 2024-09-13 18:19:03
合計ジャッジ時間 2,633 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

p = str(input())
plist = [int(x) for x in list(p)]

if len(plist) == 1:
    print('No')
    quit()
elif len(plist) == 2:
    if 12 <= int(p) <= 14:
        print('Yes')
    else:
        print('No')
    quit()

if 1 >= plist[-1] or plist[-1] >= 5:
    print('No')
    quit()

if plist[0] == 1:
    if max(plist[1:-1]) <= 5 and min(plist[1:-1]) >= 3:
        print('Yes')
    else:
        print('No')
    quit()
elif 6 <= plist[0] <= 8:
    sw = 0
    for ps in plist[:-1]:
        if sw != 0 and 3 <= ps <= 5:
            sw = 3
            continue
        elif 0 <= sw <= 1 and ps == 6:
            sw = 0
            continue
        elif 0 <= sw <= 1 and ps == 7:
            sw = 1
            continue
        elif 0 <= sw <= 1 and ps == 8:
            sw = 2
            continue
        else:
            print('No')
            quit()
else:
    print('No')
    quit()

print('Yes')
0