結果

問題 No.49 算数の宿題
ユーザー szkhtsszkhts
提出日時 2021-11-23 08:02:55
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 263 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,584 KB
実行使用メモリ 9,228 KB
最終ジャッジ日時 2023-08-24 17:50:56
合計ジャッジ時間 944 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
9,100 KB
testcase_01 AC 26 ms
9,196 KB
testcase_02 AC 24 ms
9,092 KB
testcase_03 AC 24 ms
9,192 KB
testcase_04 AC 25 ms
9,164 KB
testcase_05 AC 25 ms
9,228 KB
testcase_06 AC 25 ms
9,204 KB
testcase_07 AC 25 ms
9,112 KB
testcase_08 AC 25 ms
9,068 KB
testcase_09 AC 25 ms
9,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

S = input()

op = re.split('\d+', S)
ope = re.split('[+*]', S)

ans = int(ope[0])
j = 1
for i in range(len(op)):
    if op[i] == '*':
        ans += int(ope[j])
        j += 1
    elif op[i] == '+':
        ans *= int(ope[j])
        j += 1

print(ans)
0