結果

問題 No.222 引き算と足し算
コンテスト
ユーザー tnoda_
提出日時 2015-08-24 19:27:07
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 62 ms / 1,000 ms
+ 835µs
コード長 436 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 82 ms
コンパイル使用メモリ 62,216 KB
実行使用メモリ 62,820 KB
最終ジャッジ日時 2026-11-13 11:23:18
合計ジャッジ時間 4,237 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)
0