結果

問題 No.49 算数の宿題
ユーザー kutsutama
提出日時 2018-03-18 20:20:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 293 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-12-23 01:58:39
合計ジャッジ時間 986 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input() + '*'

res = 0
num = 0
ns = ''
op = '*'
for c in s:
    if c == '*' or c == '+':
        if op == '*':
            res += num
        elif op == '+':
            res *= num
        ns = ''
        op = c
    else:
        ns += c
        num = int(ns)
print(res)
0