結果

問題 No.1458 Segment Function
ユーザー netyo715netyo715
提出日時 2021-03-31 21:38:34
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 379 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 8,872 KB
最終ジャッジ日時 2023-08-02 17:30:13
合計ジャッジ時間 2,949 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 15 ms
7,828 KB
testcase_02 AC 15 ms
7,832 KB
testcase_03 AC 15 ms
7,784 KB
testcase_04 AC 14 ms
7,824 KB
testcase_05 AC 15 ms
7,800 KB
testcase_06 AC 14 ms
7,744 KB
testcase_07 AC 16 ms
7,772 KB
testcase_08 AC 46 ms
8,332 KB
testcase_09 AC 46 ms
8,336 KB
testcase_10 AC 47 ms
8,332 KB
testcase_11 AC 45 ms
8,384 KB
testcase_12 AC 47 ms
8,460 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 15 ms
7,968 KB
testcase_24 AC 17 ms
8,352 KB
testcase_25 AC 15 ms
7,800 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 15 ms
7,796 KB
testcase_29 AC 16 ms
8,340 KB
testcase_30 AC 17 ms
8,512 KB
testcase_31 RE -
testcase_32 AC 45 ms
8,428 KB
testcase_33 AC 48 ms
8,332 KB
testcase_34 AC 46 ms
8,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P, N = input().split()
N = int(N)

f = {"0": 6, "1": 2, "2": 5, "3": 5, "4": 4, "5": 5, "6": 6, "7": 4, "8": 7, "9": 6, "-": 1}

last = dict()
A = [P]

i = 0
while i<N:
    x = 0
    for p in A[-1]:
        x += f[p]
    
    x = str(x)

    if x in last:
        looplen = i-last[x]
        N -= looplen*((N-i)//looplen)

    A.append(x)
    last[x] = i
    i += 1

print(A[-1])
0