Files
python/TangDou/XiTi/1347.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

47 lines
1.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
//税后所得为T元,税前工资S
int T, S, A;
cin >> T; //9255,目标,反向求得S
//通过除100,再乘100,成功将十位和个位去掉,保留百位以前的数字
S = T;
S /= 100;
S *= 100;
//以100为增量,向上加,找到结果
for (;; S += 100) {
int sum = 0;
A = S - 3500;
if (A <= 0) break;
//A中不超过1500元的部分,税率3%;
if (A >= 1500) sum += 1500 * 0.03;
if (A < 1500 && A > 0) sum += A * 0.03;
//A中超过1500元未超过4500元的部分,税率10%;
if (A >= 4500) sum += (4500 - 1500) * 0.1;
if (A > 1500 && A < 4500) sum += (A - 1500) * 0.1;
//A中超过4500元未超过9000元的部分,税率20%;
if (A >= 9000) sum += (9000 - 4500) * 0.2;
if (A > 4500 && A < 9000) sum += (A - 4500) * 0.2;
//A中超过9000元未超过35000元的部分,税率25%;
if (A >= 35000) sum += (35000 - 9000) * 0.25;
if (A > 9000 && A < 35000) sum += (A - 9000) * 0.25;
//A中超过35000元未超过55000元的部分,税率30%;
if (A >= 55000) sum += (55000 - 35000) * 0.3;
if (A > 35000 && A < 55000) sum += (A - 35000) * 0.3;
//A中超过55000元未超过80000元的部分,税率35%;
if (A >= 80000) sum += (80000 - 55000) * 0.35;
if (A > 55000 && A < 80000) sum += (A - 55000) * 0.35;
//A中超过80000元的部分,税率45%;
if (A >= 80000) sum += (A - 80000) * 0.45;
if (S - sum >= T)break;
}
cout << S << endl;
return 0;
}