五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

LeetCode2303. Calculate Amount Paid in Taxes

2023-02-11 13:55 作者:您是打尖兒還是住店呢  | 我要投稿


You are given a?0-indexed?2D integer array?brackets?where?brackets[i] = [upperi, percenti]?means that the?ith?tax bracket has an upper bound of?upperi?and is taxed at a rate of?percenti. The brackets are?sorted?by upper bound (i.e.?upperi-1?< upperi?for?0 < i < brackets.length).

Tax is calculated as follows:

  • The first?upper0?dollars earned are taxed at a rate of?percent0.

  • The next?upper1?- upper0?dollars earned are taxed at a rate of?percent1.

  • The next?upper2?- upper1?dollars earned are taxed at a rate of?percent2.

  • And so on.

You are given an integer?income?representing the amount of money you earned. Return?the amount of money that you have to pay in taxes.?Answers within?10-5?of the actual answer will be accepted.

?

Example 1:

Input: brackets = [[3,50],[7,10],[12,25]], income = 10Output: 2.65000Explanation:Based on your income, you have 3 dollars in the 1st tax bracket, 4 dollars in the 2nd tax bracket, and 3 dollars in the 3rd tax bracket. The tax rate for the three tax brackets is 50%, 10%, and 25%, respectively. In total, you pay $3 * 50% + $4 * 10% + $3 * 25% = $2.65 in taxes.

Example 2:

Input: brackets = [[1,0],[4,25],[5,50]], income = 2Output: 0.25000Explanation:Based on your income, you have 1 dollar in the 1st tax bracket and 1 dollar in the 2nd tax bracket. The tax rate for the two tax brackets is 0% and 25%, respectively. In total, you pay $1 * 0% + $1 * 25% = $0.25 in taxes.

Example 3:

Input: brackets = [[2,50]], income = 0Output: 0.00000Explanation:You have no income to tax, so you have to pay a total of $0 in taxes.

?

Constraints:

  • 1 <= brackets.length <= 100

  • 1 <= upperi?<= 1000

  • 0 <= percenti?<= 100

  • 0 <= income <= 1000

  • upperi?is sorted in ascending order.

  • All the values of?upperi?are?unique.

  • The upper bound of the last tax bracket is greater than or equal to?income.

雖然是個easy 題目,但是能超過100%也是開心的,呵呵;

Runtime:?0 ms, faster than?100.00%?of?Java?online submissions for?Calculate Amount Paid in Taxes.

Memory Usage:?42.3 MB, less than?56.25%?of?Java?online submissions for?Calculate Amount Paid in Taxes.



LeetCode2303. Calculate Amount Paid in Taxes的評論 (共 條)

分享到微博請遵守國家法律
北流市| 上思县| 泉州市| 汾西县| 大兴区| 邛崃市| 房山区| 叶城县| 朝阳县| 宁城县| 威远县| 上思县| 宣威市| 香格里拉县| 正定县| 庐江县| 阆中市| 天门市| 通榆县| 侯马市| 望都县| 巩义市| 镇巴县| 海丰县| 涟源市| 军事| 七台河市| 岫岩| 永顺县| 漳州市| 黄冈市| 绿春县| 南郑县| 阿拉善盟| 霍林郭勒市| 阳新县| 芦溪县| 翼城县| 自贡市| 饶河县| 富平县|