-
Notifications
You must be signed in to change notification settings - Fork 0
/
B.cpp
29 lines (25 loc) · 916 Bytes
/
B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <bits/stdc++.h>
using namespace std;
const int MAX = 200007;
const int MOD = 1000000007;
void solve() {
long long a, b, c;
cin >> a >> b >> c;
cout << fixed << setprecision(17);
if (a == 0 && b == 0) {
if (c == 0) {cout << -1 << endl; return;}
else {cout << 0 << endl; return;}
}
if (a == 0) {cout << 1 << endl << (long double)(-c) / b << endl; return;}
if (b * b - 4ll * a * c < 0) {cout << 0 << endl; return;}
if (b * b - 4ll * a * c == 0) {cout << 1 << endl << (long double)(-b)/(2ll * a); return;}
cout << 2 << endl;
long double v1 = (long double)(-b - sqrt(b * b - 4ll * a * c))/(2ll * a), v2 = (long double)(-b + sqrt(b * b - 4ll * a * c))/(2ll * a);
cout << min(v1, v2) << endl << max(v1, v2) << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve();}
solve();
}