結果

問題 No.1458 Segment Function
ユーザー shotoyooshotoyoo
提出日時 2021-03-31 21:42:49
言語 PyPy3
(7.3.13)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 587 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 86,776 KB
実行使用メモリ 79,228 KB
最終ジャッジ日時 2023-08-02 17:30:55
合計ジャッジ時間 6,017 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
76,264 KB
testcase_01 AC 79 ms
76,344 KB
testcase_02 AC 77 ms
76,344 KB
testcase_03 AC 78 ms
76,172 KB
testcase_04 AC 80 ms
76,348 KB
testcase_05 AC 77 ms
76,504 KB
testcase_06 AC 83 ms
76,308 KB
testcase_07 AC 78 ms
76,344 KB
testcase_08 AC 89 ms
78,252 KB
testcase_09 AC 93 ms
77,856 KB
testcase_10 AC 90 ms
78,432 KB
testcase_11 AC 90 ms
78,236 KB
testcase_12 AC 88 ms
77,972 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 80 ms
76,340 KB
testcase_24 AC 69 ms
72,196 KB
testcase_25 AC 82 ms
76,492 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 67 ms
71,240 KB
testcase_29 AC 69 ms
72,176 KB
testcase_30 AC 69 ms
71,944 KB
testcase_31 RE -
testcase_32 AC 89 ms
78,252 KB
testcase_33 AC 89 ms
78,148 KB
testcase_34 AC 90 ms
78,208 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