Love丶FFC's Blog

CCF-CSP_20161202:工资计算

2019-11-24 19:06:27
阅读:1272   •   评论:12
标签:,

问题描述

小明的公司每个月给小明发工资,而小明拿到的工资为交完个人所得税之后的工资。假设他一个月的税前工资(扣除五险一金后、未扣税前的工资)为S元,则他应交的个人所得税按如下公式计算:

1) 个人所得税起征点为3500元,若S不超过3500,则不交税,3500元以上的部分才计算个人所得税,令A=S-3500元;

2) A中不超过1500元的部分,税率3%;

3) A中超过1500元未超过4500元的部分,税率10%;

4) A中超过4500元未超过9000元的部分,税率20%;

5) A中超过9000元未超过35000元的部分,税率25%;

6) A中超过35000元未超过55000元的部分,税率30%;

7) A中超过55000元未超过80000元的部分,税率35%;

8) A中超过80000元的部分,税率45%;

例如,如果小明的税前工资为10000元,则A=10000-3500=6500元,其中不超过1500元部分应缴税1500×3%=45元,超过1500元不超过4500元部分应缴税(4500-1500)×10%=300元,超过4500元部分应缴税(6500-4500)×20%=400元。总共缴税745元,税后所得为9255元。

已知小明这个月税后所得为T元,请问他的税前工资S是多少元。

输入格式

输入的第一行包含一个整数T,表示小明的税后所得。所有评测数据保证小明的税前工资为一个整百的数。

输出格式

输出一个整数S,表示小明的税前工资。

样例输入

9255

样例输出

10000

评测用例规模与约定

对于所有评测用例,1 ≤ T ≤ 100000。

编程语言:Python

解题思想:

1.枚举法

2.将税后工资化为100的整数倍,如9255化为9200,尽可能减少枚举的次数

3.注意判断的细节即可

时间复杂度:O(n)

IDE代码如下:

  1. After = int(input()) # 输入税后工资
  2. for i in range(After // 100 * 100, 100001, 100):
  3. Exceed = i - 3500 # 需要交税的部分
  4. if Exceed > 80000:
  5. Decrease = (Exceed - 80000) * 0.45 + 8750 + 6000 + 6500 + 900 + 300 + 45
  6. elif 55000 < Exceed <= 80000:
  7. Decrease = (Exceed - 55000) * 0.35 + 6000 + 6500 + 900 + 300 + 45
  8. elif 35000 < Exceed <= 55000:
  9. Decrease = (Exceed - 35000) * 0.3 + 6500 + 900 + 300 + 45
  10. elif 9000 < Exceed <= 35000:
  11. Decrease = (Exceed - 9000) * 0.25 + 900 + 300 + 45
  12. elif 4500 < Exceed <= 9000:
  13. Decrease = (Exceed - 4500) * 0.2 + 300 + 45
  14. elif 1500 < Exceed <= 4500:
  15. Decrease = (Exceed - 1500) * 0.1 + 45
  16. elif 0 < Exceed <= 1500:
  17. Decrease = Exceed * 0.03
  18. else:
  19. Decrease = 0
  20. if After + Decrease == i:
  21. print(i)
  22. break

评论板

共有 12 条评论

  1. Jorcift

    For each microarray dataset, the raw data were background corrected and normalized with RMA 24 priligy online

  2. cheap louis vuitton handbags

    Read reviews and was a little hesitant since I had already inputted my order. otherwise but thank god, I had no issues. choose to received item in a timely matter, they are in new condition. manner in which so happy I made the purchase. Will be definitely be purchasing again.
    cheap louis vuitton handbags https://www.louisvuittonsoutlet.com/

  3. cheap jordans online

    Read reviews and was a little hesitant since I had already inputted my order. actually but thank god, I had no issues. prefer the received item in a timely matter, they are in new condition. an invaluable so happy I made the purchase. Will be definitely be purchasing again.
    cheap jordans online https://www.realjordansretro.com/

  4. cheap real jordans

    Read reviews and was a little hesitant since I had already inputted my order. actually but thank god, I had no issues. choose the received item in a timely matter, they are in new condition. an invaluable so happy I made the purchase. Will be definitely be purchasing again.
    cheap real jordans https://www.realjordansshoes.com/

  5. intuido

    Serious Use Alternative 1 rivaroxaban and apixaban both increase anticoagulation generic cialis for sale Symptoms include swelling of the hands and feet, fatigue and frequent infections, as well as periods of pain called crises

  6. AaRMQye

    which have effects on lipid regulation and ferroptosis prescriptions for propecia in nj PubMed 9067774

  7. Ptlmxm

    order fenofibrate generic tricor brand cost fenofibrate

  8. Akxyxn

    buy cialis canada viagra medication viagra 100mg uk

  9. Qyymnx

    ketotifen us buy ziprasidone 40mg online cheap imipramine 75mg cost

  10. Xvvhhg

    minoxytop online order canadian cialis online pharmacy buy erection pills

  11. Ndvhfl

    acarbose 50mg us where to buy acarbose without a prescription order griseofulvin online

--------查看该分类下最新文章--------
^
新版博客正在完善中!域名:http://www.loveffc:8080,点击跳转,完全移植后将去除端口号。

Copyright © 2018 - 2021 FFC的小站 - 滇 ICP 备 18010780 号 - 1

- Powered by WordPress & AliYun · Theme by FFC -

- Environment by Windows & XAMPP · Designed by WebStorm & VSCode -

已运行:

访问量:511450