m = int(input().strip())
def f(x):
if 0<=x<2:
return 2.5-x
elif 2<=x<4:
return 2-1.5*(x-3)*(x-3)
elif 4<=x<6:
return x/2-1.5
for i in range(m):
x = eval(input().strip())
y = f(x)
print('y={0:.1f}'.format(y))
KY240 分段函数
最新推荐文章于 2024-11-03 20:27:08 发布