E. Quadratic equation

    传统题 1000ms 256MiB

Quadratic equation

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem 3. Quadratic equation

Problem description

Solving a linear equation is too hard, so we will solve a quadratic equation. A quadratic equation is of the form ax2+bx+c=0ax^2+bx+c=0, where a,b,ca,b,c are constant real numbers and the unknown xRx\in\mathbb R.

Given the coefficients a,ba,b and cc, your task is to solve the quadratic equation ax2+bx+c=0ax^2+bx+c=0.

To make the problem easier, aa may be zero. To make the problem harder, it is guaranteed that a,b,cZa,b,c\in\mathbb Z.

Solve the equation and output the solution(s).

  • If the equation is a quadratic one, your output should be of one of the following forms (where ??? is replaced with the exact solution):
    • x1 = x2 = ???
    • x1 = ???, x2 = ??? where x1<x2x_1<x_2
    • No solution.
  • Otherwise, your output should be of one of the following forms (where ??? is replaced with the exact solution):
    • x = ???
    • No solution.
    • x\in\mathbb{R}, indicating xRx\in\mathbb R in LaTeX\LaTeX

All the output numbers should be rounded to three decimal places.

It is guaranteed that a,b,c100|a|,|b|,|c|\leqslant 100.

The first five testcases are linear equations. The rest are quadratic equations.

Examples

Example 1

Input

1 2 1

Output

x1 = x2 = -1.000

Example 2

Input

1 0 1

Output

No solution.

Example 3

Input

0 0 0

Output

x\in\mathbb{R}

Example 4

Input

1 3 2

Output

x1 = -2.000, x2 = -1.000

CS100 Spring2025 Homework 1

未认领
状态
已结束
题目
5
开始时间
2025-2-28 0:00
截止时间
2025-3-9 23:59
可延期
0 小时