結果

問題 No.49 算数の宿題
ユーザー santafe1006santafe1006
提出日時 2018-11-18 10:46:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 9,076 KB
最終ジャッジ日時 2023-08-24 17:40:43
合計ジャッジ時間 1,028 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
8,884 KB
testcase_01 AC 25 ms
8,956 KB
testcase_02 AC 25 ms
8,976 KB
testcase_03 AC 25 ms
9,040 KB
testcase_04 AC 25 ms
9,008 KB
testcase_05 AC 25 ms
9,048 KB
testcase_06 AC 25 ms
9,076 KB
testcase_07 AC 26 ms
9,048 KB
testcase_08 AC 25 ms
9,004 KB
testcase_09 AC 25 ms
9,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
s = input()
s = s.replace('*','a')
s = s.replace('+','*')
s = s.replace('a','+')
reg1 = r'[0-9]+'
reg2 = r'[+*]'

nums = re.findall(reg1,s)
ops = re.findall(reg2,s)
for i in range(len(ops)) :
    if i == 0 :
        w = nums[i]
    x = str(w) + ops[i] + nums[i+1]
    w = eval(x)
print(w)
0