結果
| 問題 |
No.1458 Segment Function
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-19 00:14:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 794 bytes |
| コンパイル時間 | 215 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 23,872 KB |
| 最終ジャッジ日時 | 2024-12-22 01:53:58 |
| 合計ジャッジ時間 | 4,785 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 6 |
ソースコード
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)))