結果
| 問題 |
No.1135 RPN
|
| ユーザー |
|
| 提出日時 | 2021-02-25 14:41:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 335 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 55,252 KB |
| 最終ジャッジ日時 | 2024-10-01 05:39:29 |
| 合計ジャッジ時間 | 1,798 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
N = int(input())
from collections import deque
st = deque()
A = list(input().split())
for i in range(N):
if A[i] == "-":
y = st.pop()
x = st.pop()
st.append(x - y)
elif A[i] == "+":
y = st.pop()
x = st.pop()
st.append(x + y)
else:
st.append(int(A[i]))
print(st.pop())