#B2047. Piecewise Function Evaluation
Piecewise Function Evaluation
Piecewise Function Evaluation
Given a number x, compute the value of the piecewise function defined as follows:
$$ f(x)=\begin{cases} -x+2.5,&\quad 0\le x<5,\\[5pt] 2-1.5(x-3)^2,&\quad 5\le x<10,\\[5pt] \frac{x}{2}-1.5,&\quad 10\le x<20. \end{cases} $$
Please note that the input will always be within one of the specified ranges.
inputFormat
The input consists of a single floating point number x.
outputFormat
Output the computed value of the function f(x) corresponding to the given input.
sample
2
0.5