結果

問題 No.653 E869120 and Lucky Numbers
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-19 00:26:58
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 686 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 81,376 KB
実行使用メモリ 65,584 KB
最終ジャッジ日時 2023-10-21 08:28:57
合計ジャッジ時間 3,349 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,184 KB
testcase_01 AC 40 ms
53,184 KB
testcase_02 AC 39 ms
53,184 KB
testcase_03 AC 39 ms
53,184 KB
testcase_04 AC 39 ms
53,184 KB
testcase_05 AC 40 ms
53,184 KB
testcase_06 AC 43 ms
59,212 KB
testcase_07 RE -
testcase_08 AC 40 ms
53,184 KB
testcase_09 AC 39 ms
53,184 KB
testcase_10 AC 39 ms
53,184 KB
testcase_11 AC 38 ms
53,184 KB
testcase_12 AC 39 ms
53,184 KB
testcase_13 AC 39 ms
53,184 KB
testcase_14 AC 40 ms
53,184 KB
testcase_15 AC 40 ms
53,184 KB
testcase_16 AC 40 ms
53,184 KB
testcase_17 AC 39 ms
53,184 KB
testcase_18 AC 39 ms
53,184 KB
testcase_19 AC 39 ms
53,184 KB
testcase_20 AC 39 ms
53,184 KB
testcase_21 AC 39 ms
53,184 KB
testcase_22 AC 40 ms
53,184 KB
testcase_23 AC 40 ms
53,184 KB
testcase_24 AC 39 ms
53,184 KB
testcase_25 AC 39 ms
53,184 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 46 ms
59,524 KB
testcase_29 AC 46 ms
59,524 KB
testcase_30 AC 44 ms
59,516 KB
testcase_31 AC 40 ms
53,184 KB
testcase_32 AC 40 ms
53,184 KB
testcase_33 AC 40 ms
53,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def after78(p):
    if p[-1] == "1":
        return len(p) == 1
    while p:
        x = p.pop()
        if not x in "67":
            return False
    return True


def main():
    p = input()
    if len(p) == 1:
        if p == "6" or "7":
            return True
        return False

    p = list(p)
    # 一桁目は3, 4のどっちか
    if not p[-1] in "234":
        return False
    p.pop()
    while p:
        x = p.pop()
        if x == "1":
            return len(p) == 0
        if x in "78":
            return after78(p)
        if not x in "345":
            return False
    return True  # たぶんこここない


if main():
    print("Yes")
else:
    print("No")
0