結果
問題 | No.539 インクリメント |
ユーザー |
![]() |
提出日時 | 2017-07-11 02:33:24 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 777 ms / 2,000 ms |
コード長 | 628 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-10-07 13:58:02 |
合計ジャッジ時間 | 3,047 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
import stringdef inc(s):carry = len(s) > 0ret = ""for c in s[::-1]:if not carry:ret += celif c == '9':ret += '0'else:ret += str(int(c) + 1)carry = Falseif carry:ret += '1'return ret[::-1]n = int(input())for j in range(n):s = input()l = 0r = -1digit = Falsefor i,c in enumerate(s):if c in string.digits:r = iif not digit:l = idigit = Trueelse:digit = Falseprint(s[:l] + inc(s[l:r+1]) + s[r+1:])