結果

問題 No.222 引き算と足し算
ユーザー nebukuro09
提出日時 2016-10-04 17:41:38
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 321 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-11-21 15:53:53
合計ジャッジ時間 1,514 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
s = raw_input()
nums = re.findall('\d+', s)
ops = re.split('\d+', s)
ans = int(ops[0]+nums[0])
if len(ops[1]) == 1:
    if ops[1] == '-':
        ans += int(nums[1])
    else:
        ans -= int(nums[1])
elif ops[1][0] == '+':
    ans -= int(ops[1][1]+nums[1])
else:
    ans += int(ops[1][1]+nums[1])
print ans
0