#include<stdio.h>
int main()
{
float x, y;
printf("input x,please:\n");
scanf("%f", &x);
if(x<40&&x>=20)
{
y = -0.5 * x + 20;
}
else if(x<20&&x>=10)
{
y = 10;
}
else if(x<10&&x>=0)
{
y = x;
}
else if(x<0)
{
y = 0;
}
else
{
printf("error.\n");
return 0;
}
printf("%f\n", y);
return 0;
}