SquareEquation/armtatevik | SquareEquation/sus801 | ||||
---|---|---|---|---|---|
f | 1 | import math | f | 1 | import math |
2 | a, b, c = eval(input()) | 2 | a, b, c = eval(input()) | ||
3 | d = b ** 2 - 4 * a * c | 3 | d = b ** 2 - 4 * a * c | ||
4 | if d > 0: | 4 | if d > 0: | ||
5 | x1 = (-b + math.sqrt(d)) / (2 * a) | 5 | x1 = (-b + math.sqrt(d)) / (2 * a) | ||
6 | x2 = (-b - math.sqrt(d)) / (2 * a) | 6 | x2 = (-b - math.sqrt(d)) / (2 * a) | ||
n | 7 | if x1 < x2: | n | 7 | if x2 < x1: |
8 | print(x2, x1) | ||||
9 | else: | ||||
8 | print(x1, x2) | 10 | print(x1, x2) | ||
n | 9 | else: | n | ||
10 | print(x2, x1) | ||||
11 | if d == 0 and a != 0: | 11 | if d == 0 and a != 0: | ||
12 | x = -b / (2 * a) | 12 | x = -b / (2 * a) | ||
t | 13 | print(x) | t | 13 | print(str(x)) |
14 | if d < 0: | 14 | if d < 0: | ||
15 | print("0") | 15 | print("0") | ||
16 | if a == 0 and b == 0: | 16 | if a == 0 and b == 0: | ||
17 | print("-1") | 17 | print("-1") | ||
18 | 18 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|