P1449 后缀表达式
#include <bits/stdc++.h>
using namespace std;
int main(){
int x=0,tmp,a,b;
string s;
stack<int> stk;
cin>>s;
for(int i=0;i<s.length()-1;i++){
if(!isdigit(s[i])&&s[i]!='.'){a=stk.top();stk.pop();b=stk.top();stk.pop();}
switch(s[i]){
case '+':stk.push(a+b);break;
case '-':stk.push(a-b);break;
case '*':stk.push(a*b);break;
case '/':stk.push(a/b);break;
default:x=0;while(s[i]!='.')x=x*10+(s[i]-'0');stk.push(x);
}
}
cout<<stk.top()<<endl;
return 0;
}