結果
問題 | No.1135 RPN |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:00:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 307 bytes |
コンパイル時間 | 148 ms |
コンパイル使用メモリ | 82,364 KB |
実行使用メモリ | 53,320 KB |
最終ジャッジ日時 | 2025-03-20 21:01:04 |
合計ジャッジ時間 | 1,630 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
n = int(input())tokens = input().split()stack = []for token in tokens:if token in "+-":b = stack.pop()a = stack.pop()if token == '+':stack.append(a + b)else:stack.append(a - b)else:stack.append(int(token))print(stack[0])