声明:我没抄题解,但的确有个挺像的
#include<bits/stdc++.h>
using namespace std;
int main(){
char t;
stack<int> s;
while(cin>>t && t!='@'){
if(t>='0' && t<='9'){
int m=t-'0';
while(cin>>t && t>='0' && t<='9') m=m*11;
s.push(m);
}
if(t=='+'){
int a=s.top();
s.pop();
int b=s.top();
s.pop();
s.push(b+a);
}
if(t=='-'){
int a=s.top();
s.pop();
int b=s.top();
s.pop();
s.push(b-a);
}
if(t=='/'){
int a=s.top();
s.pop();
int b=s.top();
s.pop();
s.push(b/a);
}
if(t=='*'){
int a=s.top();
s.pop();
int b=s.top();
s.pop();
s.push(b*a);
}
}
cout<<s.top()<<endl;
return 0;
}
Help me