税率计算
来源:互联网 发布:appstore下载不了软件 编辑:程序博客网 时间:2024/06/02 17:58
问题描述:
For incomes from wages and salaries, the progressive tax rate in excess of specific amount is applicable. The income amount taxable shall be the remainder after deducting 3500 yuan from the monthly income. The tax rate is below:
Grade Monthly Taxable Income
Tax Rate(%)
Income of 1,500 yuan or less
3%
That part of income in excess of 1,500 to 4,500 yuan
10%
That part of income in excess of 4,500 to 9,000 yuan
20%
That part of income in excess of 9,000 to 35,000 yuan
25%
That part of income in excess of 35,000 to 55,000 yuan
30%
That part of income in excess of 55,000 to 80,000 yuan
35%
That part of income in excess of 80,000 yuan
45%
Given the tax Little Hi paid, do you know his salary this month?
输入
Line 1: M, the tax Little Hi paid. (1 <= M <= 5,000,000)
输出
Line 1: Little Hi’s salary. The number should be rounded dowm to the nearest integer.
提示
Little Hi’s salary is 15692 yuan. The tax is calculated below:
The income amount taxable is 15692 - 3500 = 12192 yuan.
That part of income of 1500 or less: 1500 * 3% = 45 yuan.
That part of income in excess of 1,500 to 4,500 yuan: 3000 * 10% = 300 yuan.
That part of income in excess of 4,500 to 9,000 yuan: 4500 * 20% = 900 yuan.
That part of income in excess of 9,000 to 35,000 yuan: (12192 - 9000) * 25% = 798 yuan.
Total tax is 45 + 300 + 900 + 798 = 2043 yuan.
注意本题中,税率计算时是分段的所以,每次加的值是增量。另外为了编程方便,可以在数组头加上0,收入最大值写上float最大值。
#include <cstdio>#include <algorithm>#include <cmath>#include <limits>float rate[] = {0, 0.03, 0.10, 0.20, 0.25, 0.30, 0.35, 0.45};float income[] = {0, 1500, 4500, 9000, 35000, 55000, 80000, std::numeric_limits<float>::max()};int main(){ float tax; float salary; scanf("%f", &tax); salary = 3500; for (int i = 1; i< sizeof(rate)/sizeof(float); i++) { float maxTax = (income[i] - income[i-1]) * rate[i]; if (tax > maxTax) { salary += income[i]- income[i-1]; tax -= maxTax; } else{ salary += tax / rate[i]; break; } } printf("%d\n", (int)floorf(salary));}
- 计算税率
- 计算税率
- 税率计算
- 计算税率
- C#计算税率
- 税率计算公式
- 计算工资税率
- 设计vb程序计算税率
- 根据税码取税率计算税额
- 税率
- 税率
- 2011税率改革 3500起征 个人所得税计算
- 二手车车辆购置税税率及过户费的计算
- 取税率
- 取税率
- 税率金额
- 税率金额
- 退税率
- Java泛型简介
- 现场编程比赛普及组决赛题解
- windows下安装pillow,numpy和matplotlib
- 最小生成树(Kruskal)
- Ruby 'require' error: cannot load such file
- 税率计算
- The following classes could not be found: android.support.v7.internal.app.WindowDecorActionBar
- OCP 052 卷2 40-60
- Http协议下的浏览器与服务器的交互
- 99乘法表
- 1099. Build A Binary Search Tree (30)
- Length of Last Word
- UINavigationController
- springMVC指定跳转viewName跳转404找不到页面