結果
| 問題 |
No.222 引き算と足し算
|
| コンテスト | |
| ユーザー |
tnoda_
|
| 提出日時 | 2015-08-24 19:27:07 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 1,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 274 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-15 22:03:40 |
| 合計ジャッジ時間 | 1,553 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / 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_