結果

問題 No.222 引き算と足し算
コンテスト
ユーザー 💕💖💞
提出日時 2016-09-18 00:26:30
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 335 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 129 ms
コンパイル使用メモリ 77,712 KB
最終ジャッジ日時 2025-12-03 21:31:52
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 28 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import re
l = raw_input()
def rep(x):
  if x == "+":
    x = "-" 
  elif x == "-":
    x = "+" 
  return x
l = re.sub("\+(\d)", r"\1", l)
l = re.sub("(\d)-\+(\d)", r"\1-\2", l)
l = re.sub("(\d)\+\+(\d)", r"\1+\2", l)
l = re.sub("(\d)-(\d)", r"\1+-\2", l)
m = map(lambda x:rep(x), re.findall("\+|-?\d{1,}|-", l)) 
print eval("".join(m))
0