解题思路:先是分段,不同阶段不同抽成,阶梯式的计算
注意事项:整型与浮点型的数据相乘,需要注意输出格式
参考代码:
#includeint main() { int x; int m; scanf("%d",&x); m=x/100000; switch(m) {case 0: printf("%.f",x*0.1);break; case 1: printf("%.f",10000+(x-100000)*0.075);break; case 2: printf("%.f",17500+(x-200000)*0.05);break; case 3: printf("%.f",17500+(x-200000)*0.05);break; case 4: printf("%.f",27500+(x-400000)*0.03);break; case 5: printf("%.f",27500+(x-400000)*0.03);break; case 6: printf("%.f",33500+(x-600000)*0.015);break; case 7: printf("%.f",33500+(x-600000)*0.015);break; case 8: printf("%.f",33500+(x-600000)*0.015);break; case 9: printf("%.f",33500+(x-600000)*0.015);break; default : printf("%.f",39500+(x-1000000)*0.01); } return 0; }
0.0分
1 人评分