#22281: 小數不能int( )????


myyafaq@gmail.com (ㄚ哩)


a,b,c=map(int,input("").split())

if b**2-4*a*c == 0:

    print("Two same roots x="+str(int((-b+(b**2-4*a*c)**(1/2))/2*a)))

elif b**2-4*a*c >> 0:

    print("Two different roots x1="+str((-b+(b**2-4*a*c)**(1/2))/2*a)+" , x2="+str((-b-(b**2-4*a*c)**(1/2))/2*a))

else:

    print("No real root")

#22429: Re:小數不能int( )????


snakeneedy (蛇~Snake)


你的

print("Two different roots x1="+str((-b+(b**2-4*a*c)**(1/2))/2*a)+" , x2="+str((-b-(b**2-4*a*c)**(1/2))/2*a))

是沒有加 int()

 

還有這段

elif b**2-4*a*c >> 0:

應該是 > 0 而非 >> 0