結果

問題 No.49 算数の宿題
ユーザー rlangevinrlangevin
提出日時 2023-01-08 23:20:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 5,000 ms
コード長 363 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 71,472 KB
最終ジャッジ日時 2023-08-24 17:52:39
合計ジャッジ時間 2,029 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,012 KB
testcase_01 AC 80 ms
71,104 KB
testcase_02 AC 81 ms
71,472 KB
testcase_03 AC 77 ms
71,012 KB
testcase_04 AC 77 ms
71,268 KB
testcase_05 AC 77 ms
71,312 KB
testcase_06 AC 76 ms
70,932 KB
testcase_07 AC 80 ms
71,184 KB
testcase_08 AC 78 ms
71,172 KB
testcase_09 AC 79 ms
71,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list("*" + input())
ans = 0
flag = 0
num = 0
for s in S:
    if s == "*" or s == "+":
        if flag:
            ans *= int(num)
        else:
            ans += int(num)
        num = ""
        if s == "*":
            flag = 0
        else:
            flag = 1
    else:
        num += s
if flag:
    ans *= int(num)
else:
    ans += int(num)
print(ans)
0