SquareEquation/Khachatur_khachatryan_701 | SquareEquation/Stephan | ||||
---|---|---|---|---|---|
f | 1 | import math | f | 1 | import math |
2 | a, b, c = [int(x) for x in input().split(',')] | 2 | a, b, c = [int(x) for x in input().split(',')] | ||
n | 3 | d = b ** 2 - 4 * a * c | n | 3 | dis = b ** 2 - 4 * a * c |
4 | if a == b == c == 0: | 4 | if a == b == c == 0: | ||
5 | print(-1) | 5 | print(-1) | ||
n | 6 | elif d > 0: | n | 6 | elif dis > 0: |
7 | x1 = (-b + math.sqrt(d)) / (2 * a) | 7 | i = (-b + math.sqrt(dis)) / (2 * a) | ||
8 | x2 = (-b - math.sqrt(d)) / (2 * a) | 8 | j = (-b - math.sqrt(dis)) / (2 * a) | ||
9 | if x1 < x2: | 9 | if i < j: | ||
10 | print(x1, x2) | 10 | print(i, j) | ||
11 | else: | 11 | else: | ||
t | 12 | print(x2, x1) | t | 12 | print(j, i) |
13 | elif d == 0: | 13 | elif dis == 0: | ||
14 | x = -b / (2 * a) | 14 | x = -b / (2 * a) | ||
15 | print(x) | 15 | print(x) | ||
16 | else: | 16 | else: | ||
17 | print(0) | 17 | print(0) | ||
18 | 18 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|