結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-26 12:51:31 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
WA
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 577 bytes |
| 記録 | |
| コンパイル時間 | 78 ms |
| コンパイル使用メモリ | 65,060 KB |
| 実行使用メモリ | 53,872 KB |
| 最終ジャッジ日時 | 2026-10-16 00:58:22 |
| 合計ジャッジ時間 | 2,155 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 1 |
ソースコード
def myeval(S):
op = ""
num = ""
res = 0
for c in S:
if c != "+" and c != "*":
num += c
else:
if op == "":
res = int(num)
else:
if op == "+":
res += int(num)
else:
res *= int(num)
num = ""
op = c
if op == "+":
res += int(num)
else:
res *= int(num)
return res
S = input().rstrip()
S = S.replace("*", "%")
S = S.replace("+", "*")
S = S.replace("%", "+")
print(myeval(S))