标签:== back push tor cto += span poi return
class Solution { public: int calPoints(vector<string>& ops) { vector<int> v; for (auto &s : ops) { if (s == "+") { v.push_back(v[v.size()-1] + v[v.size()-2]); } else if (s == "D") { v.push_back(v.back() * 2); } else if (s == "C") { v.pop_back(); } else v.push_back(stoi(s)); } int res = 0; for (auto i : v) res += i; return res; } };
标签:== back push tor cto += span poi return
原文地址:https://www.cnblogs.com/JTechRoad/p/10050202.html