結果

問題 No.222 引き算と足し算
ユーザー 👑 KazunKazun
提出日時 2020-09-05 14:52:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 1,000 ms
コード長 268 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,912 KB
実行使用メモリ 53,572 KB
最終ジャッジ日時 2024-05-06 09:30:06
合計ジャッジ時間 2,600 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,772 KB
testcase_01 AC 43 ms
52,332 KB
testcase_02 AC 38 ms
52,376 KB
testcase_03 AC 37 ms
52,336 KB
testcase_04 AC 38 ms
52,820 KB
testcase_05 AC 38 ms
52,944 KB
testcase_06 AC 38 ms
52,112 KB
testcase_07 AC 37 ms
53,012 KB
testcase_08 AC 37 ms
53,084 KB
testcase_09 AC 38 ms
52,640 KB
testcase_10 AC 38 ms
52,440 KB
testcase_11 AC 37 ms
52,456 KB
testcase_12 AC 38 ms
53,216 KB
testcase_13 AC 37 ms
52,424 KB
testcase_14 AC 37 ms
53,500 KB
testcase_15 AC 36 ms
53,248 KB
testcase_16 AC 37 ms
53,348 KB
testcase_17 AC 36 ms
52,248 KB
testcase_18 AC 36 ms
52,152 KB
testcase_19 AC 35 ms
53,408 KB
testcase_20 AC 36 ms
52,120 KB
testcase_21 AC 36 ms
52,444 KB
testcase_22 AC 37 ms
52,492 KB
testcase_23 AC 37 ms
53,284 KB
testcase_24 AC 37 ms
52,756 KB
testcase_25 AC 37 ms
53,572 KB
testcase_26 AC 37 ms
52,328 KB
testcase_27 AC 38 ms
52,124 KB
testcase_28 AC 38 ms
53,040 KB
testcase_29 AC 38 ms
52,360 KB
testcase_30 AC 38 ms
53,224 KB
testcase_31 AC 38 ms
52,612 KB
testcase_32 AC 38 ms
52,976 KB
testcase_33 AC 38 ms
53,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()

if not(S[0]=="+" or S[0]=="-"):
    S="+"+S

try:
    a=float("inf")
    a=S[1:].index("+")
except:
    pass

try:
    b=float("inf")
    b=S[1:].index("-")
except:
    pass

if a<b:
    T=S[:a+1]+"-"+S[a+2:]
else:
    T=S[:b+1]+"+"+S[b+2:]

print(eval(T))
0