結果

問題 No.1458 Segment Function
ユーザー shotoyooshotoyoo
提出日時 2021-03-31 21:42:49
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 587 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 76,964 KB
最終ジャッジ日時 2024-04-20 17:37:58
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
72,108 KB
testcase_01 AC 63 ms
71,868 KB
testcase_02 AC 62 ms
71,692 KB
testcase_03 AC 66 ms
72,064 KB
testcase_04 AC 62 ms
72,068 KB
testcase_05 AC 63 ms
71,680 KB
testcase_06 AC 63 ms
72,192 KB
testcase_07 AC 63 ms
71,916 KB
testcase_08 AC 76 ms
76,544 KB
testcase_09 AC 76 ms
76,524 KB
testcase_10 AC 76 ms
76,420 KB
testcase_11 AC 76 ms
76,964 KB
testcase_12 AC 76 ms
76,416 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 64 ms
72,448 KB
testcase_24 AC 42 ms
53,240 KB
testcase_25 AC 60 ms
71,808 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 38 ms
52,480 KB
testcase_29 AC 41 ms
53,632 KB
testcase_30 AC 42 ms
53,504 KB
testcase_31 RE -
testcase_32 AC 75 ms
76,672 KB
testcase_33 AC 77 ms
76,544 KB
testcase_34 AC 75 ms
76,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")

p,n = input().split()
n = int(n)
l = [6,2,5,5,4,5,6,4,7,6]
if n==0:
    write(p)
else:
    n -= 1
    if p[0]=="-":
        v = sum((l[v] for v in map(int, p[1:]))) + 1
    else:
        v = sum((l[v] for v in map(int, p)))
    res = []
    for _ in range(10000):
        res.append(v)
        v = sum((l[int(vv)] for vv in str(v)))
    if n>=len(res):
        print(res[-1])
    else:
        print(res[n])
0