-
个人简介
稀释还是牺牲,我在权衡……
n = input().split() st = [] ans = '' top = -1 for i in n: if '0' <= i <= '9': ans += i if i == '(': st.append(i) top += 1 if i == '*' or i == '/': if top == -1 or st[top] == '(' or st[top] == '+' or st[top] == '-': top += 1 st.append(i) if st[top] == '*' or st[top] == '/': ans += st.pop() st.append(i) if i == '+' or i == '-': if top == -1 or st[top] == '(': top += 1 st.append(i) else: ans += st.pop() st.append(i) if i == ')': while st.pop() != '(': ans += st.pop() top -= 1 while top != -1: ans += st.pop() top -= 1 print(ans)
-
最近活动
This person is lazy and didn't join any contests or homework.