0
已解决
题目链接: 酷丁编程:11498
#include<bits/stdc++.h>
using namespace std;
stack<int> s;
string a;
int n,m;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a;
if(a=="+"){
int x=s.top();
s.pop();
x=s.top()+x;
s.pop();
s.push(x);
}else if(a=="*"){
int x=s.top();
s.pop();
x=s.top()*x;
s.pop();
s.push(x);
}else{
stringstream ss;
ss<<a;
ss>>m;
s.push(m);
}
}
printf("%d",s.top());
return 0;
}
10分Wa
