# 11239: 【原1239】欢总找工作

### 题目描述

author: Lin Li 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1239 ﻿

4000

15

8000

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;
}