結果
問題 |
No.222 引き算と足し算
|
ユーザー |
👑 |
提出日時 | 2019-03-26 13:27:41 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 341 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-11 01:20:42 |
合計ジャッジ時間 | 1,165 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 1 |
ソースコード
s = io.read() s = string.gsub(s, "%+%+", "+") s = string.gsub(s, "%+%-", "-") s = string.gsub(s, "%-%+", "-") s = string.gsub(s, "%-%-", "+") as, a, bs, b = string.match(s, "([%+%-]*)(%d+)([%+%-])(%d+)") a = tonumber(a) b = tonumber(b) if(as == "-") then a = -a end if(bs == "+") then io.write(a - b) else io.write(a + b) end io.write("\n")