結果

問題 No.1458 Segment Function
ユーザー netyo715
提出日時 2021-03-31 21:38:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 379 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-10-12 13:34:46
合計ジャッジ時間 2,650 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 RE * 13
権限があれば一括ダウンロードができます

ソースコード

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