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)y=f(x) 的值。结果保留到小数点后三位。

y=x+2.5;0x<5y=-x+2.5; 0≤x<5

y=21.5(x3)(x3);5x<10y=2-1.5(x-3)(x-3); 5≤x<10

y=x/21.5;10x<20y=x/2-1.5; 10≤x<20

【输入】

一个浮点数 N(0N<20)N (0 ≤ N < 20)

【输出】

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

【输入样例】

1.0

【输出样例】

1.500

【来源】

一本通在线评测

A班第七天测试

Not Attended
Status
Done
Rule
Ledo
Problem
8
Start at
2025-7-27 19:00
End at
2025-7-27 21:00
Duration
2 hour(s)
Host
Partic.
8