結果

問題 No.653 E869120 and Lucky Numbers
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-19 00:34:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 634 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,952 KB
実行使用メモリ 10,176 KB
最終ジャッジ日時 2023-10-21 08:29:07
合計ジャッジ時間 2,329 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,076 KB
testcase_01 AC 29 ms
10,100 KB
testcase_02 AC 28 ms
10,096 KB
testcase_03 AC 26 ms
10,108 KB
testcase_04 AC 27 ms
10,092 KB
testcase_05 AC 27 ms
10,096 KB
testcase_06 AC 26 ms
10,096 KB
testcase_07 RE -
testcase_08 AC 26 ms
10,124 KB
testcase_09 AC 26 ms
10,076 KB
testcase_10 AC 26 ms
10,076 KB
testcase_11 AC 28 ms
10,076 KB
testcase_12 AC 29 ms
10,076 KB
testcase_13 AC 29 ms
10,076 KB
testcase_14 AC 28 ms
10,076 KB
testcase_15 AC 28 ms
10,076 KB
testcase_16 AC 28 ms
10,076 KB
testcase_17 AC 27 ms
10,076 KB
testcase_18 AC 25 ms
10,076 KB
testcase_19 AC 26 ms
10,076 KB
testcase_20 AC 26 ms
10,076 KB
testcase_21 AC 25 ms
10,076 KB
testcase_22 AC 25 ms
10,076 KB
testcase_23 AC 26 ms
10,076 KB
testcase_24 AC 25 ms
10,076 KB
testcase_25 AC 25 ms
10,076 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 27 ms
10,176 KB
testcase_29 AC 26 ms
10,176 KB
testcase_30 AC 27 ms
10,176 KB
testcase_31 AC 27 ms
10,076 KB
testcase_32 AC 25 ms
10,076 KB
testcase_33 AC 26 ms
10,076 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:
        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