Individual Income Tax
P1 : Individual Income Tax
Description
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?
Input
Line 1: M, the tax Little Hi paid. (1 <= M <= 5,000,000)
Output
Line 1: Little Hi's salary. The number should be rounded dowm to the nearest integer.
Hint
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.
- Sample Input
-
2043
- Sample Output
-
15692
#include<iostream> #include<string> using namespace std; int main() { float fTaxTotal=0; cin >> fTaxTotal;//Input Tax if (fTaxTotal>5000000) cout << "out of range"; if (fTaxTotal < 1) cout << 0; string sResult = ""; float fTaxPointList[7]; fTaxPointList[0] = 0.03; fTaxPointList[1] = 0.10; fTaxPointList[2] = 0.20; fTaxPointList[3] = 0.25; fTaxPointList[4] = 0.30; fTaxPointList[5] = 0.35; fTaxPointList[6] = 0.45; float fTaxList[6]; fTaxList[0] = (1500-0)*0.03; fTaxList[1] = (4500 - 1500)*0.10; fTaxList[2] = (9000 - 4500)*0.20; fTaxList[3] = (35000 - 9000)*0.25; fTaxList[4] = (55000 - 35000)*0.30; fTaxList[5] = (80000 - 55000)*0.35; float fTaxToComeList[7]; fTaxToComeList[0] = 0; fTaxToComeList[1] = 1500; fTaxToComeList[2] = 4500; fTaxToComeList[3] = 9000; fTaxToComeList[4] = 35000; fTaxToComeList[5] = 55000; fTaxToComeList[6] = 80000; int iTaxLevel=0; float fFindTaxTotal = fTaxTotal; for (; iTaxLevel < 6; iTaxLevel++) { fFindTaxTotal -= fTaxList[iTaxLevel]; if (fFindTaxTotal <= 0) { break; } } float fIncome = 3500; fIncome += fTaxToComeList[iTaxLevel]; for (int i = 0; i < iTaxLevel;i++) { fTaxTotal -= fTaxList[i]; } fIncome += fTaxTotal / fTaxPointList[iTaxLevel]; cout << fIncome; return 0; }
题目给出的答案是满足的,但是结果只有50分,Wrong Answer...还不清楚到底是哪一组的数据会通过不了。