arr1 = [80000, 55000, 35000, 9000, 4500, 1500, 0]
rate = [0.45, 0.35, 0.30, 0.25, 0.2, 0.1, 0.03]
money = int(input("请输入你的税前工资:")) - 3500
Sum = 0
for i in range(0, 7):
if money > arr1[i]:
# print((money - arr1[i]) * rate[i])
Sum += (money - arr1[i]) * rate[i]
money = arr1[i]
print(Sum)
3.汉诺塔
def hannuo(n, a, b, c):
if n == 1:
print(a, "-----", c)
# if n == 2:
# print(a, "-----", b)
# print(a, "-----", c)
# print(b, "-----", c)
else:
hannuo(n-1,a, c, b) # 先把a上n-1个珠子通过c这个踏板转移至b
print(a, "-----", c) # 在吧a上第n个珠子转移到c
hannuo(n-1,b, a, c) # 在把b上n-1个珠子通过a这个踏板转移至c