結果
| 問題 |
No.1135 RPN
|
| ユーザー |
|
| 提出日時 | 2020-07-27 22:43:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 346 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 82,280 KB |
| 実行使用メモリ | 54,016 KB |
| 最終ジャッジ日時 | 2024-06-28 20:18:51 |
| 合計ジャッジ時間 | 1,791 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
import sys
input = sys.stdin.readline
from collections import *
N = int(input())
A = list(input().split())
q = deque([])
for Ai in A:
if Ai=='+':
a = q.pop()
b = q.pop()
q.append(a+b)
elif Ai=='-':
a = q.pop()
b = q.pop()
q.append(b-a)
else:
q.append(int(Ai))
print(q[0])