赞
踩
思路,由于就这么4句话,可以看出每一句话的第二位是运算符,只用看这一位就行了
class Solution { public: int finalValueAfterOperations(vector<string>& operations) { short x = 0; short l1; l1 = operations.size(); for(int i = 0; i < l1 ;i++){ if(operations[i][1] == '+'){ x++; }else{ x--; } } return x; } };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。