项目三-利润提成问题.c 714 B

12345678910111213141516171819
  1. #include <stdio.h>
  2. int main() {
  3. float input,money,result;
  4. scanf("%f",&input);
  5. money = input * 10000;
  6. if(input <= 10) result = money * 0.1;
  7. else if(input <= 20) result = 100000 * 0.1 + (money - 100000) * 0.075;
  8. else if(input <= 40) result = 100000 * 0.1 + 100000 * 0.075 + (money - 200000) * 0.05;
  9. else if(input <= 60) result = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + (money - 400000) * 0.03;
  10. else if(input <= 100) result = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + (money - 600000) * 0.015;
  11. else result = 100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + 400000 * 0.015 + (money - 1000000) * 0.01;
  12. result /= 10000;
  13. printf("*%.2f",result);
  14. return 0;
  15. }