class Solution(object):
def totalMoney(self, n):
week, day = 1, 1
res = 0
for i in range(n):
res += week + day - 1
day += 1
if day == 8:
day = 1
week += 1
return res
1.直接一个for循环n次,计算一周能存多少钱,如果天数等于8就相当于下周一,把天数置位,在上周一的基础上加1继续循环