问题及代码:
#include <stdio.h>
int main()
{
int s,m;
scanf("%d",&s);
if(s<=10000)
m=s*0.1;
else if(s<=20000)
m=10000*0.1+(s-10000)*0.075;
else if(s<=40000)
m=10000*0.1+10000*0.75+(s-20000)*0.05;
else if(s<=60000)
m=10000*0.1+10000*0.075+20000*0.05+(s-40000)*0.03;
else if(s<=100000)
m=10000*0.1+10000*0.075+20000*0.05+20000*0.03+(s-60000)*0.015;
else
m=10000*0.1+10000*0.075+20000*0.05+20000*0.03+40000*0.015+(s-100000)*0.01;
printf("%d",m);
return 0;
}
运行结果: