CCF工资计算(水题)

注意题目中所说在没扣税之前工资为整百数!!!

没扣税之前工资为整百数!!!

没扣税之前工资为整百数!!!

没扣税之前工资为整百数!!!

重要的事情说三遍 可以AC了。

#include<iostream>
using namespace std;
int main()
{
    int salary;
    int total;
    int t;
    cin>>salary;
    int x;
    x=salary/100;
    while(1)
    {
        total=x*100;
        if(total<=3500)
        {
            t=0;
        }
        else
        {
            int A=total-3500;
            if(A<=1500)
            {
                t=A*0.03;
            }
            else if(A<=4500)
            {
                t=1500*0.03+(A-1500)*0.1;
            }
            else if(A<=9000)
            {
                t=1500*0.03+3000*0.1+(A-4500)*0.2;
            }
            else if(A<=35000)
            {
                t=1500*0.03+3000*0.1+4500*0.2+(A-9000)*0.25;
            }
            else if(A<=55000)
            {
                t=1500*0.03+3000*0.1+4500*0.2+26000*0.25+(A-35000)*0.3;
            }
            else if(A<=80000)
            {
                t=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+(A-55000)*0.35;
            }
            else
            {
                t=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+25000*0.35+(A-80000)*0.45;
            }
        }
        if(total-t==salary)
        {
            cout<<total<<endl;
            break;
        }
        x++;
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_40458569/article/details/81318149
今日推荐