結果
| 問題 | No.222 引き算と足し算 |
| コンテスト | |
| ユーザー |
tnoda_
|
| 提出日時 | 2015-08-24 19:27:07 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 1,000 ms |
| コード長 | 436 bytes |
| 記録 | |
| コンパイル時間 | 141 ms |
| コンパイル使用メモリ | 77,424 KB |
| 最終ジャッジ日時 | 2025-12-03 16:24:32 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
from re import findall
ts = findall('\+|\-|\d+', raw_input())
x, y, op, ans = None, None, None, None
if ts[0] == '-':
x = -int(ts[1])
ts = ts[2:]
elif ts[0] == '+':
x = int(ts[1])
ts = ts[2:]
else:
x = int(ts[0])
ts = ts[1:]
op = ts[0]
ts = ts[1:]
if ts[0] == '-':
y = -int(ts[1])
elif ts[0] == '+':
y = int(ts[1])
else:
y = int(ts[0])
if op == '+':
ans = x - y
else:
ans = x + y
print(ans)
tnoda_