結果
問題 | No.539 インクリメント |
ユーザー | Mr.Fuku |
提出日時 | 2018-08-15 15:48:08 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 483 ms / 2,000 ms |
コード長 | 702 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 11,912 KB |
実行使用メモリ | 12,660 KB |
最終ジャッジ日時 | 2023-10-24 17:27:14 |
合計ジャッジ時間 | 2,305 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
10,148 KB |
testcase_01 | AC | 68 ms
12,660 KB |
testcase_02 | AC | 68 ms
12,660 KB |
testcase_03 | AC | 483 ms
12,524 KB |
ソースコード
n=int(input()) lst = ["0","1","2","3","4","5","6","7","8","9"] for i in range(n): s = list(input()) for j in range(len(s)-1,-1,-1): if s[j] in lst: if s[j]!="9": s[j]=str(int(s[j])+1) else: while True: s[j]="0" j-=1 if j<0 or s[j] not in lst: s.insert(j+1,"1") break else: if s[j]=="9": continue else: s[j]=str(int(s[j])+1) break break print("".join(s))