結果
| 問題 |
No.222 引き算と足し算
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2019-03-26 13:31:37 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 35 ms |
| コンパイル使用メモリ | 6,952 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-11 01:20:43 |
| 合計ジャッジ時間 | 1,006 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 18 WA * 13 |
ソースコード
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(string.format("%d", a - b)) else io.write(string.format("%d", a - b)) end
io.write("\n")