2.3小节——问题 E:奖金计算

题目:

题目链接

代码

#include<cstdio>
int main(){
    double profit,prize;
    int temp;
    scanf("%lf",&profit);
    temp=(int)profit/100000;
    switch(temp){
        case 0:
            prize=profit*0.1;
            break;
        case 1:
            prize=10000+(profit-100000)*0.075;
            break;
        case 2:case 3:
            prize=17500+(profit-200000)*0.05;
            break;
        case 4:case 5:
            prize=27500+(profit-400000)*0.03;
            break;
        case 6:case 7:case 8:case 9:
            prize=33500+(profit-600000)*0.015;
            break;
        default:
            prize=39500+(profit-1000000)*0.01;
    }
    printf("%.2f\n",prize);
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_42114379/article/details/82081443
今日推荐