結果

問題 No.222 引き算と足し算
ユーザー 👑 KazunKazun
提出日時 2020-09-05 14:52:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 268 bytes
コンパイル時間 1,470 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 71,580 KB
最終ジャッジ日時 2023-08-19 02:19:38
合計ジャッジ時間 3,932 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
70,940 KB
testcase_01 AC 58 ms
71,348 KB
testcase_02 AC 59 ms
71,428 KB
testcase_03 AC 58 ms
71,136 KB
testcase_04 AC 58 ms
71,460 KB
testcase_05 AC 57 ms
71,152 KB
testcase_06 AC 57 ms
71,176 KB
testcase_07 AC 58 ms
71,464 KB
testcase_08 AC 57 ms
71,144 KB
testcase_09 AC 56 ms
71,120 KB
testcase_10 AC 57 ms
71,140 KB
testcase_11 AC 57 ms
71,580 KB
testcase_12 AC 56 ms
71,152 KB
testcase_13 AC 56 ms
71,376 KB
testcase_14 AC 56 ms
71,092 KB
testcase_15 AC 56 ms
71,256 KB
testcase_16 AC 56 ms
71,340 KB
testcase_17 AC 57 ms
70,940 KB
testcase_18 AC 58 ms
71,452 KB
testcase_19 AC 57 ms
71,140 KB
testcase_20 AC 58 ms
71,508 KB
testcase_21 AC 59 ms
71,448 KB
testcase_22 AC 58 ms
71,448 KB
testcase_23 AC 58 ms
71,452 KB
testcase_24 AC 58 ms
71,576 KB
testcase_25 AC 58 ms
71,268 KB
testcase_26 AC 59 ms
71,272 KB
testcase_27 AC 57 ms
71,332 KB
testcase_28 AC 57 ms
71,400 KB
testcase_29 AC 57 ms
71,468 KB
testcase_30 AC 58 ms
71,320 KB
testcase_31 AC 59 ms
71,432 KB
testcase_32 AC 58 ms
71,464 KB
testcase_33 AC 58 ms
71,492 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