30求调
查看原帖
30求调
828954
zym31415926_楼主2025/6/29 13:04
#include<bits/stdc++.h>
using namespace std;
int main() {
	float a, b, c;
	cin >> a >> b >> c;
	float derta = sqrt(b * b - 4 * a * c);
	float x1 = (-b + derta) / (2 * a);
	float x2 = (-b - derta) / (2 * a);
	if (x1 != x2) {
		cout.precision(5);
		cout.setf(ios::fixed);
		cout << "x1=" << x1 << ";" << "x2=" << x2;
	} else {
		cout.precision(5);
		cout.setf(ios::fixed);
		cout << "x1=x2=" << x1;
	}

	return 0;
}
2025/6/29 13:04
加载中...