Karrykk @ 2024-12-16 15:13:59
60分求助
#include<stdio.h>
int main()
{
int a;
double sum=0;
scanf("%d",&a);
if(a<=150)
{
sum=a*0.4463;
}
else if(a>150&&a<=400)
{
sum=150*0.4463+(a-150)*0.4663;
}
else
{
sum=150*0.4463+(400-150)*0.4663+(a-150-400)*0.5663;
}
printf("%.1lf",sum);
return 0;
}
by linmou @ 2024-12-16 15:19:59
else 里面不要再-150
by linmou @ 2024-12-16 15:21:10
sum=150*0.4463+(400-150)*0.4663+(a/*-150*/-400)*0.5663;
by Karrykk @ 2024-12-16 15:50:23
@linmouokok,感谢感谢