結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 15 ms
7,728 KB
testcase_02 AC 15 ms
7,692 KB
testcase_03 AC 15 ms
7,752 KB
testcase_04 AC 16 ms
7,884 KB
testcase_05 AC 16 ms
7,756 KB
testcase_06 AC 15 ms
7,872 KB
testcase_07 AC 15 ms
7,740 KB
testcase_08 AC 75 ms
10,024 KB
testcase_09 AC 74 ms
10,024 KB
testcase_10 AC 73 ms
9,872 KB
testcase_11 AC 72 ms
9,944 KB
testcase_12 AC 73 ms
9,960 KB
testcase_13 AC 17 ms
8,436 KB
testcase_14 AC 16 ms
8,348 KB
testcase_15 AC 16 ms
8,284 KB
testcase_16 AC 16 ms
8,376 KB
testcase_17 AC 16 ms
8,280 KB
testcase_18 AC 75 ms
10,316 KB
testcase_19 AC 74 ms
10,112 KB
testcase_20 AC 74 ms
10,108 KB
testcase_21 AC 75 ms
10,112 KB
testcase_22 AC 75 ms
10,260 KB
testcase_23 AC 16 ms
7,700 KB
testcase_24 WA -
testcase_25 AC 15 ms
7,760 KB
testcase_26 AC 70 ms
10,060 KB
testcase_27 AC 68 ms
10,304 KB
testcase_28 AC 15 ms
7,808 KB
testcase_29 AC 88 ms
24,188 KB
testcase_30 WA -
testcase_31 AC 16 ms
8,320 KB
testcase_32 AC 73 ms
9,872 KB
testcase_33 AC 74 ms
10,068 KB
testcase_34 AC 72 ms
10,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p, n = input().split()
add = 0
if p[0] == '-':
    add += 1
    p = p[1:]
P = [int(i) for i in p]
m = len(P)

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) + add)
    if add == 1:
        add = 0
    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