(1)栈
class Solution {
public:
int evalRPN(vector<string>& t) {
stack<int> s;
int a,b;
for(int i=0;i<t.size();i++) {
if(t[i]=="+" || t[i]=="-" || t[i]=="*" || t[i]=="/") {
a=s.top();
s.pop();
b=s.top();
s.pop();
if(t[i]=="+") s.push(a+b);
else if(t[i]=="-") s.push(b-a);
else if(t[i]=="*") s.push(b*a);
else s.push(int(b/a));
} else {
s.push(stoi(t[i]));
}
}
return s.top();
}
};