結果

問題 No.1135 RPN
ユーザー trineutron
提出日時 2020-07-31 01:23:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-05 03:06:51
合計ジャッジ時間 1,498 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = input().split()
x = []
for i in range(n):
    if a[i] == '+':
        x[-2] += x[-1]
        x.pop()
    elif a[i] == '-':
        x[-2] -= x[-1]
        x.pop()
    else:
        x.append(int(a[i]))
print(x[0])
0