結果
| 問題 |
No.49 算数の宿題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-08 15:16:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 5,000 ms |
| コード長 | 588 bytes |
| コンパイル時間 | 97 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-12-23 01:53:32 |
| 合計ジャッジ時間 | 979 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
s = input()
stc = []
stc2 = []
ope = []
for i in s:
if i.isdigit() == True:
stc.append(i)
else:
ope.append("".join(stc))
stc = []
stc2.append(i)
else:
ope.append("".join(stc))
stc = []
for j in range(len(stc2)):
ope.append(stc2.pop(0))
for k in ope:
x = 0
if k.isdigit() == True:
stc.insert(0,k)
elif k == "+":
x = int(stc.pop()) * int(stc.pop())
stc.append(str(x))
elif k == "*":
x = int(stc.pop()) + int(stc.pop())
stc.append(str(x))
else:
print(stc.pop())