输入两个数的总和与乘积,找出两个数!
假设两个数为 \( x \) 和 \( y \),已知它们的总和 \( S \) 和乘积 \( P \)。
解答:
1. 建立方程:
\( y^2 - 100y + 99 = 0 \)
2. 判别式:
\( \sqrt{100^2 - 4 \cdot 99} = \sqrt{9604} = 98 \)
3. 求解:
\( y_1 = \frac{100 + 98}{2} = 99 \),\( y_2 = \frac{100 - 98}{2} = 1 \)
\( x_1 = S - y_1 = 100 - 99 = 1 \)
\( x_2 = S - y_2 = 100 - 1 = 99 \)
结果:两个数为 \( 99 \) 和 \( 1 \)。
解答:
1. 建立方程:
\( y^2 - 45y + 500 = 0 \)
2. 判别式:
\( \sqrt{45^2 - 4 \cdot 500} = \sqrt{25} = 5 \)
3. 求解:
\( y_1 = \frac{45 + 5}{2} = 25 \),\( y_2 = \frac{45 - 5}{2} = 20 \)
\( x_1 = S - y_1 = 45 - 25 = 20 \)
\( x_2 = S - y_2 = 45 - 20 = 25 \)
结果:两个数为 \( 25 \) 和 \( 20 \)。
解答:
1. 建立方程:
\( y^2 - 25y + 144 = 0 \)
2. 判别式:
\( \sqrt{25^2 - 4 \cdot 144} = \sqrt{49} = 7 \)
3. 求解:
\( y_1 = \frac{25 + 7}{2} = 16 \),\( y_2 = \frac{25 - 7}{2} = 9 \)
\( x_1 = S - y_1 = 25 - 16 = 9 \)
\( x_2 = S - y_2 = 25 - 9 = 16 \)
结果:两个数为 \( 16 \) 和 \( 9 \)。
解答:
1. 建立方程:
\( y^2 - 62y + 960 = 0 \)
2. 判别式:
\( \sqrt{62^2 - 4 \cdot 960} = \sqrt{484} = 22 \)
3. 求解:
\( y_1 = \frac{62 + 22}{2} = 42 \),\( y_2 = \frac{62 - 22}{2} = 20 \)
\( x_1 = S - y_1 = 62 - 42 = 20 \)
\( x_2 = S - y_2 = 62 - 20 = 42 \)
结果:两个数为 \( 42 \) 和 \( 20 \)。