#include main(){ double x,y; scanf("%lf",&x); //读取double要用%lf if(x<0) y=0; else if(x<10) y=x; else if(x<20) y=10; else if(x<40) //这里少一个if y=-0.5*x+20; printf("y=%lf\n",y); //输出double要用%lf}