結果
| 問題 |
No.222 引き算と足し算
|
| コンテスト | |
| ユーザー |
nehan_der_thal
|
| 提出日時 | 2020-03-26 20:08:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 1,000 ms |
| コード長 | 307 bytes |
| コンパイル時間 | 295 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 65,304 KB |
| 最終ジャッジ日時 | 2025-01-02 03:01:14 |
| 合計ジャッジ時間 | 3,684 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
x = input().strip()
import re
#print(x)
c = re.match("^([+-]*)(\d+)([+-]*)(\d+)$", x)
#print(c.group(3))
a, b = int(c.group(2)), int(c.group(4))
#print(a, b)
if x[0] == "-":
a = -a
if len(c.group(3)) == 2 and c.group(3)[1] == "-":
b = -b
if c.group(3)[0] == "+":
print(a-b)
else:
print(a+b)
nehan_der_thal