結果

問題 No.1458 Segment Function
ユーザー lloyzlloyz
提出日時 2022-09-19 00:14:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 24,212 KB
最終ジャッジ日時 2023-08-23 18:26:57
合計ジャッジ時間 4,415 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,172 KB
testcase_01 AC 16 ms
8,160 KB
testcase_02 AC 16 ms
8,260 KB
testcase_03 WA -
testcase_04 AC 16 ms
8,184 KB
testcase_05 AC 16 ms
8,212 KB
testcase_06 AC 16 ms
8,184 KB
testcase_07 AC 17 ms
7,920 KB
testcase_08 AC 75 ms
9,972 KB
testcase_09 AC 75 ms
10,036 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 75 ms
10,032 KB
testcase_13 AC 16 ms
8,384 KB
testcase_14 AC 17 ms
8,388 KB
testcase_15 AC 17 ms
8,388 KB
testcase_16 AC 17 ms
8,368 KB
testcase_17 AC 17 ms
8,488 KB
testcase_18 AC 77 ms
10,332 KB
testcase_19 AC 76 ms
10,136 KB
testcase_20 AC 76 ms
10,200 KB
testcase_21 AC 76 ms
10,104 KB
testcase_22 AC 77 ms
10,272 KB
testcase_23 AC 16 ms
8,212 KB
testcase_24 WA -
testcase_25 AC 16 ms
8,308 KB
testcase_26 AC 71 ms
10,108 KB
testcase_27 AC 72 ms
10,320 KB
testcase_28 AC 16 ms
8,252 KB
testcase_29 AC 90 ms
24,212 KB
testcase_30 WA -
testcase_31 AC 17 ms
8,332 KB
testcase_32 WA -
testcase_33 AC 75 ms
10,032 KB
testcase_34 AC 76 ms
10,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p, n = input().split()

add = 0
if p[0] == '-':
    add += 1
    p = p[1:]
P = [int(i) for i in p]
P[0] += add
m = len(P)
idx = m - 1
while idx > 0 and P[idx] == 10:
    P[idx] = 0
    idx -= 1
    P[idx] += 1
if P[0] == 10:
    P[0] = 0
    P = [1] + P
    m += 1

def change_digit(P):
    for i in range(len(P)):
        if P[i] == 1:
            P[i] = 2
        elif P[i] == 2 or P[i] == 3:
            P[i] = 5
        elif P[i] == 0 or P[i] == 9:
            P[i] = 6
        elif P[i] == 8:
            P[i] = 7
        elif P[i] == 7:
            P[i] = 4
    return P

cnt = 0
while n != str(cnt):
    cnt += 1
    P = change_digit(P)
    sumP = str(sum(P))
    P = [int(i) for i in sumP]
    if len(P) == 1:
        if P[0] in (4, 5, 6):
            break
print(''.join(map(str, P)))
0