【思路】按照题意对初始工资S进行循环,计算缴税后工资,若与T相等则退出循环,输出结果。
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int T;
cin>>T;
if(T < )
{
cout<<T<<endl;
return ;
}
int x = ; //扣的钱
int S = ; //未缴税的工资
int A = S - ;
while(true)
{
if(A <= )
x = A * 0.03;
else if(A <= )
x = + (A - ) * 0.1;
else if(A <= )
x = + + (A - ) * 0.2;
else if(A <= )
x = + + + (A - ) * 0.25;
else if(A <= )
x = + + + + (A - ) * 0.3;
else if(A <= )
x = + + + + + (A - ) * 0.35;
else
x = + + + + + + (A - ) * 0.45;
if(S == x + T)
break;
S = S - ;
A = S - ;
}
cout<<S<<endl;
return ;
}