2303. Calculate Amount Paid in Taxes 發表於 2023-02-13 | 分類於 leetcode problemsolution1234567891011121314class Solution {public: double calculateTax(vector<vector<int>>& brackets, int income) { double ret= 0; brackets.insert(brackets.begin(),{0,0}); for(int i=1;i<brackets.size() ; ++i){ double earn = (min(brackets[i][0], income) - brackets[i-1][0]) ; earn *= brackets[i][1]; if(earn<0) break; ret += earn / 100; } return ret; }};