n = int(input())
a = list(map(int, input().split()))[::-1]
b = input().split()[::-1]
flag = True
r = 0
while b != []:
y = a[0]
a.pop(0)
x = a[0]
a.pop(0)
tt = b[0]
b.pop(0)
if tt == "+":
x += y
elif tt == "*":
x *= y
elif tt == "-":
x -= y
else:
if y == 0:
flag = False
r = x
break
x /= y
a.insert(0, int(x))
if flag:
print(a[0])
else:
print("ERROR: {}/0".format(r))
7-2 简单计算器
于 2023-11-18 23:42:11 首次发布