結果
| 問題 |
No.539 インクリメント
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-24 20:08:08 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 177 ms / 2,000 ms |
| コード長 | 717 bytes |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 15,348 KB |
| 最終ジャッジ日時 | 2024-10-12 10:31:44 |
| 合計ジャッジ時間 | 2,180 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# %%
T = int(readline())
query = readlines()
# %%
def solve_query(S):
S = list(S.rstrip().decode())
S.reverse()
S.append('$') # sentinel
L = len(S)
find = False
for i in range(L):
x = S[i]
if not x.isdigit():
if find:
S.insert(i, '1')
break
continue
find = True
if x == '9':
S[i] = '0'
continue
S[i] = str(int(x) + 1)
break
return ''.join(reversed(S[:-1]))
# %%
for word in query:
print(solve_query(word))
maspy