当前位置:网站首页>2303. Calculate the total tax payable
2303. Calculate the total tax payable
2022-07-02 15:40:00 【Laver (nori)】
class Solution {
public:
double calculateTax(vector<vector<int>>& brackets, int income) {
double ans = 0;
for(int i = brackets.size() - 1; i > 0; --i){
auto &vec = brackets[i];
auto &vec1 = brackets[i - 1];
// When income Skip directly when not in this interval
if(vec[0] > income && vec1[0] > income){
continue;
}
// The difference in the middle
int diff = income - vec1[0];
// The tax that should be paid for this part of the difference , Here is the actual value 100 times
ans += (diff * vec[1]);
// The remaining uncomputed income
income = vec1[0];
}
// Calculate the minimum range , Tax payable , Here is the actual value 100 times
ans += (income * brackets[0][1]);
// Calculate the actual tax
ans /= 100;
return ans;
}
};边栏推荐
- Equipped with Ti am62x processor, Feiling fet6254-c core board is launched!
- 语义分割学习笔记(一)
- 02.面向容器化后,必须面对golang
- [leetcode] 876 intermediate node of linked list
- Bing. Site Internet
- College entrance examination admission score line crawler
- Leetcode skimming -- verifying the preorder serialization of binary tree # 331 # medium
- yolo格式数据集处理(xml转txt)
- 6091. 划分数组使最大差为 K
- Leetcode skimming -- incremental ternary subsequence 334 medium
猜你喜欢

搭建自己的语义分割平台deeplabV3+

微信支付宝账户体系和支付接口业务流程

彻底弄懂浏览器强缓存和协商缓存

yolo格式数据集处理(xml转txt)

There are 7 seats with great variety, Wuling Jiachen has outstanding product power, large humanized space, and the key price is really fragrant

Steps for Navicat to create a new database

LeetCode刷题——统计各位数字都不同的数字个数#357#Medium

I made an istio workshop. This is the first introduction
![[leetcode] 1162 map analysis](/img/9a/d04bde0417d4d5232950a4e260eb91.png)
[leetcode] 1162 map analysis

Facing the challenge of "lack of core", how can Feiling provide a stable and strong guarantee for customers' production capacity?
随机推荐
13_ Redis_ affair
Basic knowledge of cryptography
20_ Redis_ Sentinel mode
2022 college students in Liaoning Province mathematical modeling a, B, C questions (related papers and model program code online disk download)
LeetCode刷题——两整数之和#371#Medium
2278. 字母在字符串中的百分比
College entrance examination score line climbing
10_ Redis_ geospatial_ command
For the problem that Folium map cannot be displayed, the temporary solution is as follows
【LeetCode】1905-统计子岛屿
夏季高考文化成绩一分一段表
PTA 天梯赛习题集 L2-001 城市间紧急救援
Redux - detailed explanation
17_ Redis_ Redis publish subscription
PTA ladder game exercise set l2-001 inter city emergency rescue
Force deduction solution summary 2029 stone game IX
NBA player analysis
[leetcode] 1905 statistics sub Island
Loss function and positive and negative sample allocation: Yolo series
LeetCode刷题——递增的三元子序列#334#Medium