py,90,嘤嘤嘤
查看原帖
py,90,嘤嘤嘤
727009
Foright楼主2022/5/23 20:15
a,b,c = map(float,input().split())
x,y,z = -b,b*b-4*a*c,2*a
x1 = (x+y**(1/2))/z
x2 = (x-y**(1/2))/z
if y < 0:
    print("No answer!")
if y > 0:
    if x1<x2:
        print("x1=%.5f"%x1+';'+"x2=%.5f"%x2)
    elif x1>x2:
        x1,x2=x2,x1
        print("x1=%.5f"%x1+';'+"x2=%.5f"%x2)      
if y == 0:
    print("x1=x2=%.5f"+x1)
    

2022/5/23 20:15
加载中...