#t232. 分段函数

分段函数

Piecewise Function

Problem Description

Write a program to compute the value of the following piecewise function y=f(x)y=f(x).

$$\begin{cases} y=-x+2.5,\quad &0 \le x \lt 5\\ y=2-1.5(x-3)(x-3),\quad &5 \le x \lt 10\\ y={x\over 2}-1.5,\quad &10 \le x \lt 20 \end{cases}$$

Input Format

A floating-point number xx, 0≤x<200 \le x \lt 20.

Output Format

Output the value of the piecewise function at xx: f(x)f(x), kept to three decimal places.

Sample Input

1.0

Sample Output

1.500

Hint

  • Each of the three intervals uses its own formula; get the endpoint assignment right: which segment does x=5x=5 fall into? Which does x=10x=10 fall into?
  • Keep 33 decimal places.
  • Verify with the sample: 1.0 → 1.500.