1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
class Solution:
def calculateTax(self, brackets: List[List[int]], income: int) -> float:
upper= min(brackets[0][0],income)
rate=brackets[0][1]
answer = upper * rate / 100
income-=upper
for i in range(1,len(brackets)):
if income<=0: break
else:
upper = min(brackets[i][0]-brackets[i-1][0], income)
rate = brackets[i][1]
income -= upper
answer += upper * rate / 100
return(answer)
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 2022. Convert 1D Array Into 2D Array (0) | 2022.07.11 |
---|---|
leetcode 2215. Find the Difference of Two Arrays (0) | 2022.07.08 |
leetcode 1945. Sum of Digits of String After Convert (0) | 2022.07.07 |
백준 25305 커트라인 (0) | 2022.07.07 |
leetcode 2236. Root Equals Sum of Children (0) | 2022.07.07 |
댓글