hihocoder 1102 Individual Income Tax

#1102 : Individual Income Tax

时间限制: 10000ms
单点时限: 1000ms
内存限制: 256MB

描述

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.

样例输入
2043
样例输出

15692


//没啥说的,超笨的方法

#include "iostream"
using namespace std;

int a[7],b[7];
double c[8];

int main(){

    a[0] = 0;       b[0] = 0;        c[0] = 0.00;
    a[1] = 45;      b[1] = 1500;     c[1] = 0.03;
    a[2] = 300;     b[2] = 4500;     c[2] = 0.10;
    a[3] = 900;     b[3] = 9000;     c[3] = 0.20;
    a[4] = 6500;    b[4] = 35000;    c[4] = 0.25;
    a[5] = 6000;    b[5] = 55000;    c[5] = 0.30;
    a[6] = 8750;    b[6] = 80000;    c[6] = 0.35; c[7] = 0.45;

    for(int i = 1; i <= 6; i++) a[i] = a[i]+a[i-1];

    int m,k;
    while(cin >> m){
    for(int i = 6; i >= 0;i--) {
        if(m >= a[i]) {
            k = i;
            break;
        }
    }
    cout <<(int)( b[k] + (m- a[k])/c[k+1] + 3500) << endl;

    }
  return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值