工资计算

一、问题描述

#工资计算
T = int(input())
level = 0
salary_tex = {0:(0,0.03),1500:(45,0.1),4500:(345,0.2),9000:(1245,0.25),35000:(7745,0.3),55000:(13745,0.35),80000:(22495,0.45)}
if T <= 3500:
    print(T)
else:
    for i in salary_tex:
        if i+3500-salary_tex[i][0] < T:
            level = i
    S = (T + salary_tex[level][0]-(3500+level)) / ((1/salary_tex[level][1]) - 1) + T + salary_tex[level][0]
    print(int(S))

思路

  1. 用一个字典来储存各个税收段的总税收和税收比率
  2. 判断工资在哪个税收段,然后计算原工资即可。
    这里用了一个推导:
01-05 02:38