結果
問題 | No.539 インクリメント |
ユーザー |
👑 |
提出日時 | 2019-05-27 09:00:09 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 240 ms / 2,000 ms |
コード長 | 716 bytes |
コンパイル時間 | 106 ms |
コンパイル使用メモリ | 6,812 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-09-17 15:27:30 |
合計ジャッジ時間 | 1,420 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
local n = io.read("*n", "*l")local str, sstr, pre, suf = "", "", "", ""for i = 1, n dopre, suf = "", ""str = io.read()sstr = str:match("%d+")if(sstr ~= nil and str ~= sstr) thenpre, sstr, suf = string.match(str, "(.*[^%d])(%d+)(.-)$")endif sstr == nil thenprint(str)elselocal len = #sstrlocal nums = {}for j = 1, len dotable.insert(nums, tonumber(sstr:sub(j, j)))endfor j = len, 1, -1 donums[j] = nums[j] + 1if nums[j] <= 9 thenbreakelseif j ~= 1 thennums[j] = 0endendendio.write(pre)for j = 1, len doio.write(nums[j])endio.write(suf .. "\n")endend