0
题目链接: 酷丁编程:11498
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
stack<int> st;
int toint(string s)
{
int x;
stringstream ss;
ss<<s;
ss>>x;
return x;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>s;
if(s=="+")
{
int x=st.top();
st.pop();
int y=st.top();
st.pop();
st.push(x+y);
}
else if(s=="*")
{
int x=st.top();
st.pop();
int y=st.top();
st.pop();
st.push(y*x);
}
else
{
st.push(toint(s));
}
}
cout<<st.top();
}
各位大佬,我真球球了,我错哪了呀?
答疑老师今天是放假了吗,问半天没回答。
