私信TA

用户名:dotcpp0768242

访问量:173

签 名:

等  级
排  名 30469
经  验 463
参赛次数 0
文章发表 12
年  龄 0
在职情况 学生
学  校 湖南城市学院
专  业

  自我简介:

解题思路:
将利润除以100000,所得数使用switch函数进行选择。
注意事项:

参考代码:

#include

int main(){
int i,t;
scanf("%d",&i);
int m = i/100000;
switch(m){
case 0:
t=i*0.1;break;
case 1:t=10000+(i-100000)*0.075;break;
case 2:
case 3:t=17500+(i-200000)*0.05;break;
case 4:
case 5:t=27500+(i-400000)*0.03;break;
case 6:
case 7:
case 8:
case 9:t=33500+(i-600000)*0.015;break;
default:t=39500+(i-1000000)*0.01;break;
}
printf("%d",t);
return 0 ;
}


 

0.0分

1 人评分

  评论区