結果

問題 No.222 引き算と足し算
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-03-26 20:08:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 1,000 ms
コード長 307 bytes
コンパイル時間 1,361 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 79,864 KB
最終ジャッジ日時 2023-08-30 13:16:00
合計ジャッジ時間 7,689 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
79,788 KB
testcase_01 AC 140 ms
79,864 KB
testcase_02 AC 141 ms
79,652 KB
testcase_03 AC 139 ms
79,584 KB
testcase_04 AC 143 ms
79,792 KB
testcase_05 AC 144 ms
79,804 KB
testcase_06 AC 144 ms
79,692 KB
testcase_07 AC 144 ms
79,784 KB
testcase_08 AC 143 ms
79,740 KB
testcase_09 AC 145 ms
79,640 KB
testcase_10 AC 143 ms
79,856 KB
testcase_11 AC 142 ms
79,644 KB
testcase_12 AC 144 ms
79,772 KB
testcase_13 AC 144 ms
79,780 KB
testcase_14 AC 144 ms
79,660 KB
testcase_15 AC 141 ms
79,724 KB
testcase_16 AC 142 ms
79,808 KB
testcase_17 AC 145 ms
79,680 KB
testcase_18 AC 145 ms
79,720 KB
testcase_19 AC 146 ms
79,664 KB
testcase_20 AC 143 ms
79,828 KB
testcase_21 AC 141 ms
79,720 KB
testcase_22 AC 139 ms
79,460 KB
testcase_23 AC 145 ms
79,692 KB
testcase_24 AC 147 ms
79,556 KB
testcase_25 AC 145 ms
79,700 KB
testcase_26 AC 144 ms
79,660 KB
testcase_27 AC 144 ms
79,616 KB
testcase_28 AC 144 ms
79,720 KB
testcase_29 AC 144 ms
79,588 KB
testcase_30 AC 145 ms
79,584 KB
testcase_31 AC 143 ms
79,716 KB
testcase_32 AC 144 ms
79,652 KB
testcase_33 AC 143 ms
79,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x = input().strip()
import re
#print(x)
c = re.match("^([+-]*)(\d+)([+-]*)(\d+)$", x)
#print(c.group(3))
a, b = int(c.group(2)), int(c.group(4))
#print(a, b)
if x[0] == "-":
    a = -a
if len(c.group(3)) == 2 and c.group(3)[1] == "-":
    b = -b
if c.group(3)[0] == "+":
    print(a-b)
else:
    print(a+b)
0