結果

問題 No.653 E869120 and Lucky Numbers
ユーザー ああいいああいい
提出日時 2022-01-09 22:28:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 994 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 77,048 KB
最終ジャッジ日時 2023-10-11 19:32:04
合計ジャッジ時間 4,318 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,360 KB
testcase_01 AC 78 ms
75,620 KB
testcase_02 AC 79 ms
76,116 KB
testcase_03 AC 79 ms
76,132 KB
testcase_04 AC 76 ms
75,596 KB
testcase_05 AC 80 ms
75,632 KB
testcase_06 AC 82 ms
76,224 KB
testcase_07 AC 76 ms
71,380 KB
testcase_08 AC 81 ms
75,612 KB
testcase_09 AC 77 ms
71,388 KB
testcase_10 AC 76 ms
71,424 KB
testcase_11 AC 76 ms
71,492 KB
testcase_12 AC 77 ms
71,396 KB
testcase_13 AC 77 ms
71,432 KB
testcase_14 AC 77 ms
71,560 KB
testcase_15 AC 76 ms
71,376 KB
testcase_16 AC 76 ms
71,508 KB
testcase_17 AC 76 ms
71,420 KB
testcase_18 AC 75 ms
71,116 KB
testcase_19 AC 76 ms
71,228 KB
testcase_20 AC 73 ms
71,292 KB
testcase_21 AC 76 ms
71,252 KB
testcase_22 AC 76 ms
71,380 KB
testcase_23 AC 76 ms
71,376 KB
testcase_24 AC 76 ms
71,196 KB
testcase_25 AC 78 ms
71,452 KB
testcase_26 AC 78 ms
71,036 KB
testcase_27 AC 76 ms
71,116 KB
testcase_28 AC 84 ms
77,048 KB
testcase_29 AC 84 ms
77,024 KB
testcase_30 AC 83 ms
76,660 KB
testcase_31 AC 76 ms
71,452 KB
testcase_32 AC 76 ms
71,432 KB
testcase_33 AC 76 ms
71,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p = input()

l = list(map(int,list(p)))

import sys
if len(l) == 1:
    print('No')
    exit()
n = 'No'
y = 'Yes'
if 2 <= l[-1] <= 4:
    pass
else:
    print(n)
    exit()

if l[0] == 1:
    for i in l[1:-1]:
        if 3 <= i <= 5:
            pass
        else:
            print(n)
            exit()
    print(y)
    exit()
if p.count('8') >= 2:
    print(n)
    exit()
if p.count('8') == 1:
    i = 0
    while l[i] != 8:
        if l[i] != 6 and l[i] != 7:
            print(n)
            exit()
        i += 1
    i += 1
    for j in range(i,len(l)-1):
        if 3 <= l[j] <= 5:
            pass
        else:
            print(n)
            exit()
    print(y)
    exit()
a = p.count('6') + p.count('7')
if a == 0:
    print(n)
    exit()
    
for i in range(a):
    if l[i] != 6 and l[i] != 7:
        print(n)
        exit()
if l[a-1] == 6:
    print(n)
    exit()
for j in range(a,len(l)-1):
    if 3 <= l[j] <= 5:
        pass
    else:
        print(n)
        exit()
print(y)
0