結果

問題 No.49 算数の宿題
ユーザー DrDrpilot
提出日時 2022-01-19 11:49:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-12-23 02:16:21
合計ジャッジ時間 1,335 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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