結果

問題 No.49 算数の宿題
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-04-28 20:00:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 164 ms / 5,000 ms
コード長 248 bytes
コンパイル時間 1,654 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 79,880 KB
最終ジャッジ日時 2023-08-24 17:31:55
合計ジャッジ時間 3,338 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
79,732 KB
testcase_01 AC 154 ms
79,744 KB
testcase_02 AC 157 ms
79,540 KB
testcase_03 AC 155 ms
79,784 KB
testcase_04 AC 154 ms
79,816 KB
testcase_05 AC 156 ms
79,648 KB
testcase_06 AC 159 ms
79,868 KB
testcase_07 AC 158 ms
79,880 KB
testcase_08 AC 157 ms
79,756 KB
testcase_09 AC 154 ms
79,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

S = input()
d = re.split(r"[+*]", S)
d = list(map(int, d))
ope = re.split(r"[0-9]+", S)[1:-1]

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