Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = float(input())
- b = float(input())
- c = float(input())
- D = b ** 2 - 4 * a * c
- if a == 0:
- if b == 0:
- if c == 0:
- print(3)
- else:
- print(-1)
- else:
- print(1, - c / b)
- else:
- if D > 0:
- x1 = (- b - D ** 0.5) / (2 * a)
- x2 = (- b + D ** 0.5) / (2 * a)
- if x1 % 1 == 0:
- x1 = int(x1)
- if x2 % 1 == 0:
- x2 = int(x2)
- if a > 0:
- print(2, x1, x2, sep=' ')
- else:
- print(2, x2, x1, sep=' ')
- elif D == 0:
- x = - b / (2 * a)
- if x % 1 == 0:
- x = int(x)
- print(1, x, sep=' ')
- else:
- print(-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement