1102 Individual Income Tax

1.该题给出税收,反过来求月薪,难度不大;
2.计算公式为(税收-分级税收)/当级税收比率+前一级的薪资。

时间限制: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

AC代码:

//#include<string>  
//#include<stack>  
//#include<unordered_set>  
//#include <sstream>  
//#include "func.h"  
//#include <list>  
#include <iomanip>  
#include<unordered_map>  
#include<set>  
#include<queue>  
#include<map>  
#include<vector>  
#include <algorithm>  
#include<stdio.h>  
#include<iostream>  
#include<string>  
#include<memory.h>  
#include<limits.h>  
#include<stack>
using namespace std;

int main(void) {

	int tax;
	cin >> tax;
	//建立一个税收范围数组
	vector<int> taxRange = { 0,45, 300, 900, 6500, 6000, 8750 };
	//建立一个税收比率数组
	vector<double> rate = { 0.03, 0.1, 0.2, 0.25, 0.3, 0.35,0.45 };
	//建立一个薪资数组
	vector<int> salaryRange = { 0,1500, 4500, 9000, 35000, 55000, 80000 };
	int level = 0;
	int sum = 0;
	for (; level < taxRange.size(); level++)
	{//求出刚好超过用户税收的等级
		sum += taxRange[level];
		if (tax < sum)
			break;
	}
	sum -= taxRange[level--];//求得用户刚好所在的收税等级,和在该等级多出的钱
	//计算工资
	int salary = (tax - sum) / rate[level] + salaryRange[level];
	//注意需要加上3500元
	cout << salary+3500 << endl;
	return 0;

}


发表评论

电子邮件地址不会被公开。 必填项已用*标注