-->
当前位置:首页 > 题库

PROGRAMMING:Piecewise function

Luz5年前 (2021-05-10)题库408
###Task description
```
Write a program to calculate the value of the following piecewise function y = f (x).
y=-x+2.5; 0 <= x < 5
y=2-1.5(x-3)(x-3); 5 <= x < 10
y=x/2-1.5 ; 10 <= x < 20
```
###Input format:
A floating point number n, 0 < = n < 20
###Output format:
Output the piecewise function value corresponding to N: F (n). The result is kept to three decimal places.
###Input example:
```in
one
```
###Output example:
```out
one point five zero zero
```
###Tips
###Title Source
Note: this topic is selected from openjudge website http://noi.openjudge.cn/ch0103/13/ .







answer:If there is no answer, please comment