結果

問題 No.49 算数の宿題
ユーザー AEnAEn
提出日時 2022-05-15 11:34:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 239 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 79,904 KB
最終ジャッジ日時 2023-08-24 17:51:27
合計ジャッジ時間 2,402 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
79,476 KB
testcase_01 AC 142 ms
79,796 KB
testcase_02 AC 145 ms
79,904 KB
testcase_03 AC 142 ms
79,696 KB
testcase_04 AC 140 ms
79,440 KB
testcase_05 AC 140 ms
79,816 KB
testcase_06 AC 141 ms
79,772 KB
testcase_07 AC 142 ms
79,764 KB
testcase_08 AC 142 ms
79,764 KB
testcase_09 AC 141 ms
79,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
S = input()
s = re.split('[*+]', S)
res = int(s[0])
cnt = 0
for i in range(len(S)):
    if S[i] == '+':
        res *= int(s[cnt+1])
        cnt += 1
    elif S[i] == '*':
        res += int(s[cnt+1])
        cnt += 1
print(res)
0