1716. Calculate Money in Leetcode Bank
On This Page
class Solution:
def totalMoney(self, n: int) -> int:
a, b = divmod(n, 7)
return (28 + 28 + 7 * (a - 1)) * a // 2 + (a * 2 + b + 1) * b // 2
class Solution:
def totalMoney(self, n: int) -> int:
a, b = divmod(n, 7)
return (28 + 28 + 7 * (a - 1)) * a // 2 + (a * 2 + b + 1) * b // 2