V. 作业题 - 分段函数

    Type: Default 1000ms 256MiB

作业题 - 分段函数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

原始人的老王请你帮他编写一个程序,计算下列分段函数y=f(x)的值。
当 0≤x<5 时,y=-x+2.5。
当 5≤x<10 时,y=2-1.5(x-3)(x-3)。
当 10≤x<20 时,y=x/2-1.5。

输入输出说明

输入说明

一个浮点数 x。

输出说明

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

题目样例

样例输入

1.0

样例输出

1.500

提示

对于 100% 的数据 0≤x<20。

这些题都有点善

Not Attended
Status
Done
Rule
XCPC
Problem
42
Start at
2025-1-18 13:45
End at
2025-3-5 20:45
Duration
1111 hour(s)
Host
Partic.
17