n | a, b, c = map(int, input().split(',')) | n | A, B, C = map(int, input().split(',')) |
| if a != 0: | | if A != 0: |
| disc = b ** 2 - 4 * a * c | | discriminant = B ** 2 - 4 * A * C |
| if disc > 0: | | if discriminant > 0: |
| x1 = (-b + disc ** 0.5) / (2 * a) | | root1 = (-B + discriminant ** 0.5) / (2 * A) |
| x2 = (-b - disc ** 0.5) / (2 * a) | | root2 = (-B - discriminant ** 0.5) / (2 * A) |
| roots = [] | | square_roots = [] |
| if x1 > 0: | | if root1 > 0: |
| x1_1 = x1 ** 0.5 | | positive_sqrt1 = root1 ** 0.5 |
| x1_2 = -x1 ** 0.5 | | negative_sqrt1 = -root1 ** 0.5 |
| roots.extend([x1_1, x1_2]) | | square_roots.extend([positive_sqrt1, negative_sqrt1]) |
| elif x1 == 0: | | elif root1 == 0: |
| roots.append(0) | | square_roots.append(0) |
| if x2 > 0: | | if root2 > 0: |
| x2_1 = x2 ** 0.5 | | positive_sqrt2 = root2 ** 0.5 |
| x2_2 = -x2 ** 0.5 | | negative_sqrt2 = -root2 ** 0.5 |
| roots.extend([x2_1, x2_2]) | | square_roots.extend([positive_sqrt2, negative_sqrt2]) |
| elif x2 == 0: | | elif root2 == 0: |
| roots.append(0) | | square_roots.append(0) |
| if roots: | | if square_roots: |
| print(*sorted(roots)) | | print(*sorted(square_roots)) |
| else: | | else: |
| print('0') | | print('0') |
n | elif disc == 0: | n | elif discriminant == 0: |
| x = -b / (2 * a) | | single_root = -B / (2 * A) |
| if x > 0: | | if single_root > 0: |
| x1 = x ** 0.5 | | positive_single_sqrt = single_root ** 0.5 |
| x2 = -x ** 0.5 | | negative_single_sqrt = -single_root ** 0.5 |
| print(*sorted([x1, x2])) | | print(*sorted([positive_single_sqrt, negative_single_sqrt])) |
| elif x == 0: | | elif single_root == 0: |
| print(0) | | print(0) |
| else: | | else: |
| print('0') | | print('0') |
| else: | | else: |
| print('0') | | print('0') |
n | elif b != 0: | n | elif B != 0: |
| root = -c / b | | linear_solution = -C / B |
| if root > 0: | | if linear_solution > 0: |
| print(*sorted([root ** 0.5, -root ** 0.5])) | | print(*sorted([linear_solution ** 0.5, -linear_solution ** 0.5]) |
| | | ) |
| elif root == 0: | | elif linear_solution == 0: |
| print('0') | | print('0') |
| else: | | else: |
| print('0') | | print('0') |
t | elif c == 0: | t | elif C == 0: |
| print('-1') | | print('-1') |
| else: | | else: |
| print('0') | | print('0') |