11239: 【原1239】欢总找工作
题目
题目描述
author: Lin Li 原OJ链接:https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1239
Description
快要毕业的欢总最近找了一份薪水不菲的工作,为此,欢总每月需要向国家缴纳巨额的个人所得税,为此欢总真是伤透了脑筋。快来帮帮欢总吧!
附:2011年9月起个人所得税税率表(起征点3500)
级数 全月应纳税所得额(含税所得额) 税率%
一 不超过1500元 3
二 超过1500元至4500元 10
三 超过4500元至9000元 20
四 超过9000元至35000元 25
五 超过35000元至55000元 30
六 超过55000元至80000元 35
七 超过80000元 45
Input Format
标准输入包含1行:
第1行是整数A,表示欢总的本月工资(元)。
Output Format
标准输出包含1行:
第1行输出整数B,表示欢总本月所需缴纳的个人所得税(元,向下取整)。
Sample Input1
4000
Sample Output1
15
月收入为4000,应纳税所得额为4000-3500=500,不超过1500,税率3%,应纳税500*3%=15
Sample Input2
8000
Sample Output2
345
月收入为8000,应纳税所得额为8000-3500=4500,不超过1500的部分,税率3%,应纳税1500*3%=45,超过1500元至4500元的部分,税率10%,应纳税3000*10%=300,总纳税额345
Limits
100%的数据满足:1<=A<=200000
FineArtz's solution
/* 欢总找工作 */
#include <iostream>
using namespace std;
int main(){
int n = 0, ans = 0;
cin >> n;
if (n > 3500){
n -= 3500;
if (n <= 1500) ans = n * 0.03;
else if (n <= 4500) ans = 1500 * 0.03 + (n - 1500) * 0.1;
else if (n <= 9000) ans = 1500 * 0.03 + 3000 * 0.1 + (n - 4500) * 0.2;
else if (n <= 35000) ans = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + (n - 9000) * 0.25;
else if (n <= 55000) ans = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + 26000 * 0.25 + (n - 35000) * 0.3;
else if (n <= 80000) ans = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + 26000 * 0.25 + 20000 * 0.3 + (n - 55000) * 0.35;
else ans = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + 26000 * 0.25 + 20000 * 0.3 + 25000 * 0.35 + (n - 80000) * 0.45;
}
cout << ans << endl;
return 0;
}
ligongzzz's solution
#include "iostream"
using namespace std;
int main() {
int salary;
cin >> salary;
salary -= 3500;
double ans = 0.0;
if (salary > 80000) {
ans += (salary - 80000) * 0.45;
salary = 80000;
}
if (salary > 55000) {
ans += (salary - 55000) * 0.35;
salary = 55000;
}
if (salary > 35000) {
ans += (salary - 35000) * 0.30;
salary = 35000;
}
if (salary > 9000) {
ans += (salary - 9000) * 0.25;
salary = 9000;
}
if (salary > 4500) {
ans += (salary - 4500) * 0.20;
salary = 4500;
}
if (salary > 1500) {
ans += (salary - 1500) * 0.10;
salary = 1500;
}
if (salary > 0) {
ans += (salary - 0) * 0.03;
}
cout << (int)ans;
return 0;
}
skyzh's solution
#include <iostream>
using namespace std;
#define check(d, rate) if (income > d) { \
tax += (income - d) * rate; \
income = d; \
}
int main() {
int income;
cin >> income;
int tax = 0;
income -= 3500;
check(80000, 0.45);
check(55000, 0.35);
check(35000, 0.30);
check(9000, 0.25);
check(4500, 0.20);
check(1500, 0.10);
check(0, 0.03);
cout << tax << endl;
return 0;
}