結果
問題 | No.49 算数の宿題 |
ユーザー |
|
提出日時 | 2024-05-26 12:51:31 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 577 bytes |
コンパイル時間 | 360 ms |
コンパイル使用メモリ | 82,028 KB |
実行使用メモリ | 52,224 KB |
最終ジャッジ日時 | 2024-12-20 20:15:16 |
合計ジャッジ時間 | 1,452 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
def myeval(S):op = ""num = ""res = 0for c in S:if c != "+" and c != "*":num += celse:if op == "":res = int(num)else:if op == "+":res += int(num)else:res *= int(num)num = ""op = cif op == "+":res += int(num)else:res *= int(num)return resS = input().rstrip()S = S.replace("*", "%")S = S.replace("+", "*")S = S.replace("%", "+")print(myeval(S))