Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
118452 | 梁颢城 | 后序表达式 | C++ | 编译错误 | 0 | 0 MS | 0 KB | 486 | 2023-12-30 11:32:08 |
#include<bits/stdc++.h> using namespace std; stack <double> x; stack <char> s = "+-*/()"; int main(){ double a,b; char c; cin>>a; x.push(a); while(cin>>c>>b){ if(c=='*'){ a=x.top(); x.pop(); x.push(a*b); }else if(c == '/'){ a=x.top(); x.pop(); x.push(a/b); }else if(c =='+'){ x.push(b); }else{ a=x.top(); x.pop(); x.push(a-b); } } int sum = 0; while(x.size()){ } cout<<sum<<endl; return 0; }