結果

問題 No.653 E869120 and Lucky Numbers
ユーザー Ryuto
提出日時 2018-03-19 17:03:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 873 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 61,312 KB
最終ジャッジ日時 2025-01-01 17:25:58
合計ジャッジ時間 2,872 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

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

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

if plist[0] != 2 and 3 and 4:
    print('No')
    quit()

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

print('Yes')
0