4 条题解
-
1
def calc(a,b,op): if op=='+': return a+b if op=='-': return a-b if op=='*': return a*b if op=='/': return a/b s=input() st=[0]*1000 top=-1 t=0 for i in range(len(s)): if '0'<=s[i]<='9': t=t*10+int(s[i]) elif s[i]==' ': top+=1 st[top]=t t=0 else: b=st[top] top-=1 a=st[top] top-=1 t=calc(a,b,s[i]) top+=1 st[top]=t print("%.2f"%st[0]) #对①空结果保留两位小数
信息
- ID
- 796
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- (无)
- 递交数
- 1074
- 已通过
- 217
- 上传者