代码如下:
#include <stdio.h>
#include <math.h>
int main()
{
double x,y;
scanf("%lf",&x); //输入千米数
if (x < 3)
{
y = 10;
}else if (x<7)
{
y = 10 + 1.6*(ceil(x)-3);
}else
y = 10 + 1.6 * 4 + 2.4*(ceil(x)-7);
printf("%g",y);
return 0;
}