結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,400 KB
testcase_01 AC 70 ms
71,404 KB
testcase_02 AC 71 ms
71,348 KB
testcase_03 AC 69 ms
71,288 KB
testcase_04 AC 71 ms
71,168 KB
testcase_05 AC 71 ms
71,352 KB
testcase_06 AC 70 ms
71,344 KB
testcase_07 AC 71 ms
71,212 KB
testcase_08 AC 70 ms
71,128 KB
testcase_09 AC 69 ms
71,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()+'+'
now=0
ans=0
plus=True
for i in range(len(s)):
    if s[i].isdecimal():
        now=now*10+int(s[i])
    else:
        if plus:
            ans+=now
            now=0
            if s[i]=='+':
                plus=False
        else:
            ans*=now
            now=0
            if s[i]=='*':
                plus=True
print(ans)
0