結果

問題 No.1135 RPN
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2021-07-05 21:40:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 258 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 71,688 KB
最終ジャッジ日時 2023-09-14 04:15:11
合計ジャッジ時間 2,637 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 65 ms
70,864 KB
testcase_16 AC 67 ms
70,992 KB
testcase_17 AC 67 ms
70,996 KB
testcase_18 AC 67 ms
71,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = input().split()
stack = []

for a in A:
    if a == '+':
        stack.insert(0, stack.pop(0) + stack.pop(0))
    elif a == '-':
        stack.insert(0, stack.pop(0) - stack.pop(0))
    else:
        stack.append(int(a))

print(stack[0])
0