結果

問題 No.653 E869120 and Lucky Numbers
ユーザー convexineqconvexineq
提出日時 2021-03-12 21:19:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 1,288 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 76,528 KB
最終ジャッジ日時 2023-10-11 19:31:46
合計ジャッジ時間 4,346 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,528 KB
testcase_01 AC 90 ms
76,060 KB
testcase_02 AC 81 ms
76,448 KB
testcase_03 AC 89 ms
76,156 KB
testcase_04 AC 81 ms
75,876 KB
testcase_05 AC 85 ms
76,256 KB
testcase_06 AC 84 ms
76,436 KB
testcase_07 AC 76 ms
71,148 KB
testcase_08 AC 88 ms
76,116 KB
testcase_09 AC 74 ms
71,388 KB
testcase_10 AC 73 ms
71,528 KB
testcase_11 AC 72 ms
71,236 KB
testcase_12 AC 74 ms
71,540 KB
testcase_13 AC 75 ms
71,392 KB
testcase_14 AC 75 ms
71,184 KB
testcase_15 AC 75 ms
71,452 KB
testcase_16 AC 74 ms
71,520 KB
testcase_17 AC 74 ms
71,212 KB
testcase_18 AC 73 ms
71,244 KB
testcase_19 AC 74 ms
71,448 KB
testcase_20 AC 73 ms
71,404 KB
testcase_21 AC 74 ms
71,528 KB
testcase_22 AC 73 ms
71,300 KB
testcase_23 AC 74 ms
71,320 KB
testcase_24 AC 71 ms
71,344 KB
testcase_25 AC 72 ms
71,392 KB
testcase_26 AC 73 ms
71,320 KB
testcase_27 AC 72 ms
71,320 KB
testcase_28 AC 89 ms
76,108 KB
testcase_29 AC 90 ms
76,528 KB
testcase_30 AC 89 ms
76,348 KB
testcase_31 AC 71 ms
71,320 KB
testcase_32 AC 72 ms
71,140 KB
testcase_33 AC 75 ms
71,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(p):
    def No():
        nonlocal ans
        ans = "No"
        #print("No")
        #exit()
    
    if all(ai=="6" or ai=="7" for ai in p): return "No"
    
    p = "0"+p
    c = 0
    fin = 0
    ans = "Yes"
    L = len(p)
    for j in range(L)[::-1]:
        i = int(p[j])
        if c==0:
            if i==0:
                if j == 0:
                    break
                else:
                    No()
            if i == 6 or i == 7:
                fin = 1
                c = 0
            elif i == 2 or i == 3 or i == 4:
                if fin: No()
                c = 1
            else:
                No()
        elif c==1:
            if i==1:
                if j==1:
                    c = 0
                    break
                else:
                    No()
            elif i == 7 or i == 8:
                fin = 1
                c = 0
            elif i == 3 or i == 4 or i == 5:
                if fin: No()
                c = 1
            else:
                No()
    return ans

q = [6,7]
for i in q:
    if i > 10000: break
    q += [i*10+6,i*10+7]

def guchoku(p):
    L = len(p)
    p = int(p)
    for i in q:
        for j in q:
            if i+j==p:
                return "Yes"
    return "No"

p = input()
print(solve(p))
0