結果

問題 No.49 算数の宿題
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-01 11:55:12
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 327 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 71,404 KB
最終ジャッジ日時 2023-08-24 17:50:52
合計ジャッジ時間 1,620 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,252 KB
testcase_01 AC 72 ms
70,992 KB
testcase_02 AC 72 ms
71,256 KB
testcase_03 AC 73 ms
71,128 KB
testcase_04 AC 76 ms
71,404 KB
testcase_05 AC 70 ms
71,240 KB
testcase_06 AC 71 ms
71,304 KB
testcase_07 AC 71 ms
71,140 KB
testcase_08 AC 70 ms
71,136 KB
testcase_09 AC 69 ms
71,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
l1 = []
l2 = []
num = 0
for s in S:
    if s == "+" or s == "*":
        l1.append(num)
        num = 0
        l2.append(s)
    else:
        num *= 10
        num += int(s)
l1.append(num)
ans = l1[0]

for i in range(len(l2)):
    if l2[i] == "*":
        ans += l1[i+1]
    else:
        ans *= l1[i+1]
print(ans)
0