Hi all,
以下
str1 = input()
a, b, c = str1.split(' ')
a = int(a)
b = int(b)
c = int(c)
root = b*b-4*a*c
if root < 0:
print('No real root')
elif root >= 0:
root1 = -b/2*a +(b*b-4*a*c)**0.5/2*a
root2 = -b/2*a - (b*b-4*a*c)**0.5/2*a
root1 = int(root1)
root2 = int(root2)
if root > 0:
print('Two different roots x1=',root1,' , x2=',root2, sep="")
elif root == 0:
print('Two same roots x=',root1, sep="")
謝謝