Problem1125--§1 3 分段函数

1125: §1 3 分段函数

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

编写程序,计算下列分段函数 $y=f(x)$ 的值。结果保留到小数点后三位。   
$ f(x)=\left\{
\begin{array}{rcl}
x+2.5 & & {0 \leq x < 5}\\
2-1.5\times(x-3)^2 & & {5 \leq x < 10}\\
\frac{x}{2}-1.5 & & {10 \leq x <20}
\end{array} \right. $

Input

一个浮点数 $x\ (0≤x<20)$。

Output

输出 $x$ 对应的分段函数值:$f(x)$。结果保留到小数点后三位。

Sample 1 Input

1.0

Sample 1 Output

3.500

Sample 2 Input

7.2

Sample 2 Output

-24.460

Sample 3 Input

12.83

Sample 3 Output

4.915

Source/Category