HUST Online Judge WebBoard
Problem 3990 >> 运费计算
202303140119 @ 2023-11-04 21:21:23
[ Quote ] [ Edit ] [ Delete ] 1#
#include<stdio.h>
int main()
{
float p,w,s,d,f;
scanf("%f%f%f",&p,&w,&s);
f=p*w*s*(1-d);
if(s<250)
{
d=0;
printf("freight=%.2f\n",f);

}

else if(s>=250&&s<500)
{
d=0.02;
printf("freight=%.2f\n",f);


}
else if(s>=500&&s<1000)
{
d=0.05;
printf("freight=%.2f\n",f);

}
else if(s>=1000&&s<2000)
{
d=0.08;
printf("freight=%.2f\n",f);

}
else if(s>=2000&&s<3000)
{
d=0.1;
printf("freight=%.2f\n",f);
}
else if(s>=3000)
{
d=0.15;
printf("freight=%.2f\n",f);
}
return 0;

}
202303140119 @ 2023-11-25 14:57:35
[ Quote ] [ Edit ] [ Delete ] 2#
知道了知道了