solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
import math a, b, c = map(int, input().split()) if a == 0: if b == 0 and c == 0: print(-1) elif b == 0 and c != 0: print(0) else: x = -c/b print(1) print('{:.10f}'.format(x)) else: delta = pow(b, 2) - (4 * a * c) if delta < 0: print(0) elif delta ...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; double delta(double a, double b, double c) { return b * b - 4 * a * c; } int main() { double a, b, c; cin >> a >> b >> c; double s1, s2, de = delta(a, b, c); if (de < 0) { cout << 0; return 0; } if (!a && !b && !c) { cout << -1; return 0; } i...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { int no = 0; double a, b, c, res, res1, res2, d, p, q; scanf("%lf%lf%lf", &a, &b, &c); if (a == 0 && b == 0 && c == 0) { cout << "-1" << endl; return 0; } if (a == 0 && b != 0) { res = -(c / b); printf("1\n%lf", res); return 0; ...
8
CPP
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T& x) { x = 0; char c; while (!isdigit(c = getchar())) ; do { x = x * 10 + c - '0'; } while (isdigit(c = getchar())); } template <typename T> inline void write(T x) { if (x > 9) write(x / 10); putchar(x % 10 + 48)...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { cout << setprecision(6) << fixed; double a, b, c; cin >> a >> b >> c; if (a == 0) { if (b == 0) { if (c == 0) { cout << -1; } else { cout << 0; } } else { cout << 1 << endl; cout << -c / b; } }...
8
CPP
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 10; const int N = 1010; long double a, b, c; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cin >> a >> b >> c; long double d = (b * b - 4 * a * c); if (d < 0) { cout << 0; return 0; } if (a == b && b == c &...
8
CPP
#include <bits/stdc++.h> using namespace std; template <class T> T toDec(string s) { stringstream is(s); T res; is >> res; return res; } template <class T> string toStr(T n) { string s; stringstream is; is << n; is >> s; return s; } template <class T> bool isPrime(T x) { if (x <= 1) return false; ...
8
CPP
#include <bits/stdc++.h> using namespace std; const long long A = 1e16, N = 228228, K = 8; vector<long double> x; long double d, a, b, c; long long i, j, n; int main() { cin >> a >> b >> c; if (!a) { if (!b && !c) { puts("-1"); return 0; ; } if (!b) { puts("0"); return 0; ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); long long a, b, c; cin >> a >> b >> c; if (a == 0 && b == 0 && c == 0) { printf("-1\n"); } else if (a == 0 && b == 0 && c != 0) { printf("0\n"); } else if (a == 0 && b != 0) { ...
8
CPP
a,b,c = list(map(int,input().split())) if a!=0: k = (b*b) - 4*a*c if k<0: print(0) else: a1 = (-b+(k**.5))/(2*a) a2 = (-b-(k**.5))/(2*a) if a1==a2: print(1) print(str(a1)+"0"*5) if a1!=a2: print(2) print(str(min(a1,a2))+...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (a == 0) { if (b == 0) { if (c == 0) printf("-1\n"); else printf("0\n"); } else { printf("1\n"); printf("%.5lf\n", -1.0 * c / b); } } else { long long sum ...
8
CPP
#include <bits/stdc++.h> using namespace std; const int O = 2e9; const double E = 1e-9; const double api = 3.1415926536; int DX[] = {1, -1, -1, 1}; int DY[] = {-1, 1, 1, -1}; int main() { long double a, b, c; cin >> a >> b >> c; if (a == b && b == c && a == 0) { cout << -1 << endl; return 0; } if (a =...
8
CPP
import math a, b, c = map(int, input().split()) sqr = float((b ** 2) - 4 * a * c) # 1 100000 -100000 if sqr >= 0: e = float(math.sqrt(sqr)) # print(e) if e == 0: try: root1 = float((-b - e) / (2 * a)) root = 1 print(root) prin...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; double x1, x2; cin >> a >> b >> c; if (a == 0) { if (b == 0) { if (c == 0) { cout << "-1"; return 0; } if (c != 0) { cout << "0"; return 0; } } else { cout << "1" <...
8
CPP
#include <bits/stdc++.h> using namespace std; double a, b, c; set<double> s; int main() { cin >> a >> b >> c; if (a == 0) { if (b == 0) { if (c == 0) puts("-1"); else puts("0"); } else { puts("1"); double ans = -1.0 * c / b; printf("%0.5f", ans); } } else ...
8
CPP
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __print(float x) { cer...
8
CPP
x=list(map(int, input().split())) a=x[0] b=x[1] c=x[2] import math if a==0: if b==0: if c==0: print(-1) else: print(0) else: print(1) if c!=0: r=-c/b else: r=abs(c/b) print("{:.10f}".format(r)) else: d=(b*b)-(4*a...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c, e, f, g, h; double x1, x2, x3, z, m, d; cin >> a >> b >> c; m = ((b * b) - (4 * a * c)); if (m < 0) { cout << 0 << endl; } else if (a == 0) { if (b == 0 && c != 0) { cout << 0 << endl; } else if (b == 0 && c == 0) {...
8
CPP
#include <bits/stdc++.h> int main() { long long w, x, y, z; double a, b; scanf("%lld %lld %lld", &w, &x, &y); if (w) { z = x * x - (4 * w * y); if (z > 0) { a = (-x - sqrt(z)) / (2 * w); b = (-x + sqrt(z)) / (2 * w); if (w > 0) printf("2\n%lf\n%lf\n", a, b); else ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 0) { if (b == 0) printf(c == 0 ? "-1\n" : "0\n"); else printf("1\n%f\n", (double)-c / b); return 0; } long long d = (long long)b * b - 4LL * a * c; if (d < 0) printf("0\n"); els...
8
CPP
#include <bits/stdc++.h> using namespace std; double a, b, c, x1, x2; int main() { int i, j, k, m, n, ans, len; while (scanf("%lf%lf%lf", &a, &b, &c) != EOF) { if (fabs(a) < 1e-8) { if (fabs(b) < 1e-8) { if (fabs(c) < 1e-8) printf("-1\n"); else printf("0\n"); } el...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, x1; cin >> a >> b >> c; double y, y1, y2; if (a == 0 && b == 0 && c == 0) cout << "-1"; else if (a == 0) { if (b != 0) { cout << "1" << "\n"; double y = ((double)(-c)) / b; cout << fixed << s...
8
CPP
#include <bits/stdc++.h> using namespace std; const int Z = (int)1e5 + 111; const int inf = (int)1e9 + 111; const long long llinf = (long long)1e18 + 5; int main() { ios_base::sync_with_stdio(false); long double a, b, c; cin >> a >> b >> c; if (a == 0 && b == 0 && c == 0) { cout << -1; return 0; } i...
8
CPP
__author__ = """ *** * * * * * * **** **** ***** **** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ***** * * * * * * * * * * **...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; double sqrtt(double x) { if (x < 0) return -sqrt(-x); else return sqrt(x); } int main() { double a, b, c; double x1, x2; while (cin >> a >> b >> c) { if (a == 0 && b == 0) { if (c == 0) printf("-1\n"); else printf("0\n"); ...
8
CPP
import math a,b,c = map(int,input().split()) if a == 0: if b == 0: if c == 0: print("-1") else: print("0") else: print("1") print("%.7f" %(-c/b)) else: r = b*b - 4*a*c if r < 0: print("0") elif r == 0: print("1") print(...
8
PYTHON3
from math import * a,b,c = input().split() a,b,c = int(a),int(b),int(c) d_2 = (b**2) - (4 * a * c) if d_2 < 0: print("0") elif a == 0 and b == 0: if c == 0:print("-1") else:print('0') elif a == 0 and b != 0: print("1") x_1 = -(float(c)/float(b)) print("%.10f" % x_1) else: if d_2 == 0: ...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-8; int main() { istream &fin = cin; ostream &fout = cout; FILE *fpin = stdin; FILE *fpout = stdout; int A, B, C; fin >> A >> B >> C; if (A == 0 && B == 0 && C == 0) { fout << -1 << endl; return 0; } if (A == 0) { if...
8
CPP
a,b,c = map(int,input().split()) if a ==0 and b==0: if c ==0: print("-1") else: print("0") exit(0) D = pow(b,2) -4*a*c x = -b y = pow(D,1/2) z = 2*a r = 0 if a ==0: print("1") print(-c/b) exit(0) if D < 0: print(r) exit(0) if D ==0: r = 1 e1 = (x-y)/z print(r...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; double A, B, C, d; void Stampa(double x) { cout << fixed << setprecision(7) << x << endl; } double Delta() { return pow(B, 2) - 4 * A * C; } int main() { ios::sync_with_stdio(false); cin >> A >> B >> C; if (A == 0) { if (B == 0 && C == 0) { cout << "-1\n"; ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long A, B, C; cin >> A >> B >> C; if (A == 0) { if (B == 0) { cout << (C == 0 ? -1 : 0) << '\n'; } else { cout << 1 << '\n'; cout << fixed << setprecision(10) << -1. * C / B ...
8
CPP
a, b, c = [int(x) for x in input().split()] if a == 0 and b == 0: if c == 0: print(-1) else: print(0) elif a == 0: print(1) print("{0:.5f}".format(-c/b)) else: root1 = (-b+(b**2-4*a*c)**0.5)/(2*a) root2 = (-b-(b**2-4*a*c)**0.5)/(2*a) if root1 == root2: print(1) ...
8
PYTHON3
#include <bits/stdc++.h> int main() { double a, b, c; int i, j, k, m, n; scanf("%lf%lf%lf", &a, &b, &c); if (a == 0) { if (b == 0) { if (c == 0) printf("-1\n"); else printf("0\n"); } else printf("1\n%0.10f\n", -c / b); } else { if (b * b - 4 * a * c < 0) pri...
8
CPP
#include <bits/stdc++.h> using namespace std; long long a, b, c; int main() { scanf("%lld%lld%lld", &a, &b, &c); if (a == 0 && b == 0 && c == 0) printf("-1\n"); else if (a == 0 && b == 0 && c != 0) printf("0\n"); else if (a == 0 && b != 0) printf("1\n%.10lf\n", -(double)(c) / b); else { int nu...
8
CPP
import sys, math input = sys.stdin.readline a, b, c = map(int, input().split()) if(a == 0): if(b == 0): if(c == 0): print(-1) else: print(0) else: print("1\n{:.6f}".format(-c / b)) else: delta = b * b - 4 * a * c if(delta < 0): print(0) elif(de...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { double i, a, b, c; double ans, d, r1, r2; cin >> a >> b >> c; d = (b * b - 4 * a * c); if (a == 0 && (b == 0 && c == 0)) { cout << "-1"; } else if (a == 0 && b != 0) { r1 = -c / b; printf("1\n%.6f", r1); } else if (a == 0 && b == 0) { ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c, dt; cin >> a >> b >> c; if (a == 0) { if (b == 0 && c == 0) cout << -1; else if (b == 0 && c != 0) cout << 0; else if (b != 0 && c != 0) { cout << 1 << "\n"; printf("%.8lf", -c / b); } else { c...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long a, s, d; cin >> a >> s >> d; long long ans = s * s - 4 * a * d; if (!a) { double aa = -d; aa /= s; if (!s && d) cout << 0; else if (isinf(aa) || (!s && !d)) cout << -1; else cout << 1 << endl << setprecisi...
8
CPP
#include <bits/stdc++.h> using namespace std; const long long MODN = 1000000007; int main() { ios::sync_with_stdio(false); cin.tie(0); double a, b, c; cin >> a >> b >> c; cout << fixed << setprecision(5); if (a == 0) { if (b == 0) { if (c == 0) cout << -1 << endl; else cout <...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d; cout.precision(10); cin >> a >> b >> c; if (a == 0) { if (b == 0) { if (c == 0) cout << -1; else cout << 0; } else { long double cc = -c + 0.0; cout << 1 << endl << cc / b; } } ...
8
CPP
#include <bits/stdc++.h> const double eps = 1e-8; const double pi = 3.1415926535897932; using namespace std; ifstream in("input.txt", ifstream::in); ofstream out("output.txt", ofstream::out); int main() { double ans[2]; long long A, B, C; cin >> A >> B >> C; if (A == 0) { if (B == 0) { if (C == 0) ...
8
CPP
from math import sqrt a,b,c=list(map(int,input().split())) if a==b==c==0: print(-1) else: if a==0: if b!=0: print(1) print(-c/b) else: print(0) else: d=b**2-4*a*c if d<0: print(0) elif d==0: print(1) ...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; void PTBac1(long long a, long long b) { if (a == 0) { if (b == 0) { cout << "-1"; } else { cout << "0"; } } else { cout << "1\n"; cout << fixed << setprecision(5) << 1.0 * -b / a; } } void PTBac2(long long a, long long b, long long c) {...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(false); cin.tie(0); long double a, b, c; cin >> a >> b >> c; if (a == 0 and b == 0 and c == 0) cout << -1; else if ((a == 0 and b == 0) or b * b - 4 * a * c < 0) cout << 0; else if (a == 0) cout << fixed << setpreci...
8
CPP
#include <bits/stdc++.h> using namespace std; template <typename T> typename std::set<T>::const_iterator GetNearestTo(const std::set<T>& data, const T& t) { auto upper = data.lower_bound(t); if (upper == data.begin() || (*upper) == t) return upper; auto lower = up...
8
CPP
#include <bits/stdc++.h> int main() { double a, b, c, s; scanf("%lf %lf %lf", &a, &b, &c); if (a == 0 && b == 0 && c == 0) { printf("-1"); } else if (a == 0 && b != 0) { printf("1\n%lf", (-c) / b); } else if (a == 0 && b == 0 && c != 0) { printf("%lf", b); } else { s = (b * b) - 4 * a * c; ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double A, B, C; cin >> A >> B >> C; if (A == 0 && B == 0 && C == 0) { cout << "-1"; return 0; } if (A == 0 && B == 0 && C != 0) { cout << "0"; return 0; } if (A == 0) { double z = (-C) / B; printf("1\n%.10lf", z); retur...
8
CPP
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; double a, b, c; int main() { cin >> a >> b >> c; double s = b * b - 4 * a * c; if (a == b && b == c && a == 0) return puts("-1"), 0; if (a == 0 && b == 0) return puts("0"), 0; if (a == 0) { cout << 1 << endl; printf("%.6lf\n", (-c) ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { int tc; double a, b, c; cin >> a >> b >> c; double D = b * b - 4 * a * c; int n; if (D < 0) { printf("0\n"); } else if (a == 0 && b == 0 && c == 0) cout << "-1" << endl; else if (a == 0 && b == 0) cout << "0" << endl; else if (a ==...
8
CPP
a, b, c = map(float, input().split()) d = b ** 2 - 4 * a * c if d < 0: print(0) elif a == 0 and b == 0: if c == 0: print(-1) else: print(0) elif a == 0: print(1) print(-c / b) else: x = [float((-b + d ** 0.5) / 2 / a)] v1 = float((-b - d ** 0.5) / 2 / a) if not v1 in x: ...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MOD = 1e6 + 10; int main() { double a, b, c; while (~scanf("%lf%lf%lf", &a, &b, &c)) { if (a == b && b == c && c == 0) { printf("-1\n"); continue; } double x = b * b - a * 4 * c; if (((a == 0 && b == 0) &...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; double x, y, d, p; cin >> a >> b >> c; d = b * b; p = 4 * a * c; d = d - p; if (a == 0 && b == 0 && c == 0) cout << "-1" << endl; else if (a == 0 && b == 0) cout << "0" << endl; else if (a == 0) { x = c * -1; x ...
8
CPP
#include <bits/stdc++.h> using namespace std; vector<double> v; long long n, m, i, j, t, a, b, c, k; int main() { ios_base::sync_with_stdio(0); cin >> a >> b >> c; if (a == 0 && b == 0 && c == 0) { cout << -1 << endl; return 0; } else if (a == 0 && b == 0) { cout << 0 << endl; return 0; } else...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; while (~scanf("%lf%lf%lf", &a, &b, &c)) { if (a == b && b == c && c == 0) { printf("-1\n"); continue; } double x = b * b - a * 4 * c; if (((a == 0 && b == 0) && c != 0) || x < 0) { printf("0\n"); conti...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; cin >> a >> b >> c; double d = pow(b, 2.0) - 4.0 * a * c; if (d < 0 || a == 0 && b == 0 && c != 0) { cout << 0 << "\n"; return 0; } else if (a == 0 && b == 0 && c == 0) { cout << -1 << "\n"; return 0; } else if (a == ...
8
CPP
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const long long INFLL = 0x3f3f3f3f3f3f3f3f; const int MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long a, b, c; cin >> a >> b >> c; if (a == 0) { if (b == 0 and c == 0) { cout << -1 << en...
8
CPP
A,B,C = map(int,input().split()) import math D = B * B - 4 * A * C if A == 0 and B == 0 and C == 0: print(-1) elif A == 0 and B == 0: print(0) elif A == 0: x = - C / B print(1) print('%4.5f' % x) elif D < 0: print(0) elif D > 0: x1 = (- B + math.sqrt(D)) / (2 * A) x2 = (- B ...
8
PYTHON3
import math coefficients=input().split() a=int(coefficients[0]) b=int(coefficients[1]) c=int(coefficients[2]) if (a==0 and b==0 and c==0): print(-1) elif (b**2)-4*a*c<0 or (a==0 and b==0): print(0) elif a==0: print(1) print("%.10f"%(-c/b)) else: root1=(-b-math.sqrt((b**2)-4*a*c))/(2*a) root2=(-b...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout << fixed << setprecision(10); double a, b, c; cin >> a >> b >> c; if (a == 0 && b == 0 && c == 0) cout << "-1"; else if (a == 0 && b == 0) cout << "0"; else if (a == 0) { ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; cin >> a >> b >> c; double d = b * b - 4 * a * c; if (a == 0 && b == 0 && c == 0) { cout << "-1\n"; return 0; } if (a == 0 && b == 0) { cout << "0\n"; return 0; } if (a == 0) { cout << "1\n"; printf("%.5lf...
8
CPP
#include <bits/stdc++.h> using namespace std; string s; int main() { double a, b, c; cin >> a >> b >> c; double d = b * b - 4 * a * c; if (a == b && b == c && c == 0) { cout << -1; return 0; } if (a == b && b == 0) { cout << 0; return 0; } cout << fixed << setprecision(20); if (a == 0)...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; scanf("%lf %lf %lf", &a, &b, &c); if (a == 0) { if (b == 0) { if (c == 0) printf("-1\n"); else printf("0\n"); } else { printf("1\n"); printf("%.6lf\n", -c / b); } } else { double tt...
8
CPP
#include <bits/stdc++.h> using namespace std; double A, B, C; void Output(int n, double x = 0, double y = 0) { printf("%d\n", n); if (n >= 2 && x > y) swap(x, y); if (n >= 1) printf("%.6f\n", x); if (n >= 2) printf("%.6f\n", y); } int main(void) { scanf("%lf%lf%lf", &A, &B, &C); if (fabs(A) == 0) { if (...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; long long det = b * b - 4 * a * c; if (a == 0 && b == 0 && c == 0) { cout << -1; return 0; } if (a == 0 && b == 0 && c != 0) { cout << 0; return 0; } if (a == 0 && b != 0) { cout << 1 <<...
8
CPP
#include <bits/stdc++.h> using namespace std; double r1, r2, a, b, c, delta; int main() { cin >> a >> b >> c; cout << fixed << setprecision(5); if (a == b && b == c && c == 0) { cout << -1; return 0; } if (a != 0) { delta = b * b - 4 * a * c; if (delta == 0) { cout << 1 << endl << ((-1) ...
8
CPP
import math a,b,c=map(int,input().split()) if (a==0 and b==0 and c==0): print(-1) elif(a==0 and b==0 and c!=0): print(0) elif (a==0 and b!=0): print(1) print(-c/b) elif (b*b-4*a*c<0): print(0) elif (b*b-4*a*c==0): print(1) print((-b/(2*a))) else: print(2) d=(-b+math.sqrt(b*b-4*a*c))/...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; long long d = b * b - 4 * a * c; if (a != 0) { double x = a, y = b; if (d < 0) cout << 0; if (d == 0) { cout << 1 << endl; printf("%lf", -y / (2 * x)); } if (d > 0) { cout << 2...
8
CPP
#include <bits/stdc++.h> using namespace std; double a, b, c, d; int main() { cin >> a >> b >> c; if (a == b && a == c && a == 0) { cout << -1; return 0; } if (a == 0 && b == 0) { cout << 0; return 0; } if (a == 0) { cout << 1 << endl; cout << fixed; cout << setprecision(9) << -c...
8
CPP
# https://codeforces.com/problemset/problem/20/B def find_roots(a, b, c): if (a, b, c) == (0, 0, 0): return None if (a, b) == (0, 0): return [] if a == 0: return [-c / b] d = b**2 / (4 * a**2) - c / a if d < 0: return [] m = -b / (2 * a) if d == 0: r...
8
PYTHON3
from decimal import * from math import sqrt a, b, c = map(Decimal, input().split()) if a != 0: if b**2 - 4*a*c < 0: print(0) else: arr = [(-b + Decimal(sqrt(b**2 - 4*a*c)))/(2*a), (-b-Decimal(sqrt(b**2 - 4*a*c)))/(2*a)] if max(arr) == min(arr): print(1, arr[0]) else: ...
8
PYTHON3
from math import sqrt a, b, c = list(map(int,input().strip().split(' '))) if a == 0: if b != 0: print(1) print(-1 * c/b) else: if c == 0: print(-1) else: print(0) else: if b ** 2 == 4 * a * c: print(1) print(-1 * b/(2 * a)) elif b ** 2 < 4 * a * c: print(0) else: pr...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; const long long MAX = LLONG_MAX, mod = 1000000007, MODA = 1e9 - 1; const long long MIN = LLONG_MIN; const long double PI = 3.1415926535; const long long N = 100009; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long double a, b, c; cin >> a >> b >> c...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { set<double> s; set<double>::iterator it; double a, b, c; cin >> a >> b >> c; double ans1, ans2; if (a == 0 && b == 0 && c == 0) cout << -1 << endl; else if (a == 0 && b != 0) { ans2 = -(c / b); s.insert(ans2); cout << s.size() << e...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (a == 0 && b != 0) { cout << 1 << endl; cout << fixed << setprecision(5) << -1.0 * c / b << endl; } else if (a != 0 && b == 0) { double resp = c * 1.0 / a; if (resp < 0) { cout << 2 << endl...
8
CPP
#include <bits/stdc++.h> using namespace std; class Quadratic_root { long long a, b, c; public: Quadratic_root(long a, long b, long c) : a(a), b(b), c(c) {} void Calculate_roots() { if ((b * b - 4 * a * c) < 0) cout << 0 << endl; else if (!a && !b && !c) cout << -1 << endl; else if (!a &...
8
CPP
#include <bits/stdc++.h> using namespace std; double a, b, c; int main() { cin >> a >> b >> c; double k = b * b; double l = 4 * a * c; if (a == 0) { if (b == 0 && c == 0) { cout << -1 << endl; return 0; } if (b == 0 && c != 0) { cout << 0 << endl; return 0; } if (c ==...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double A, B, C; const double EPSILON = 1e-6; cin >> A >> B >> C; if (fabs(A) < EPSILON) { if (fabs(B) < EPSILON) { if (fabs(C) < EPSILON) cout << -1 << endl; else cout << 0 << endl; } else { cout << 1 << endl; ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c, x = 4, m = 0, a1, a2, n = 2, ans; cin >> a >> b >> c; ans = b * b - x * a * c; if (a == m && b == m && c == m) { cout << -1; return 0; } if (a == m && b == m) { cout << 0; return 0; } if (a == m) { cout << 1 <...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long double a, b, c; cin >> a >> b >> c; if (a == 0 && b == 0 && c == 0) { cout << "-1" << endl; return 0; } else { if (a == 0 && b == 0 && c != 0) { cout << "0" << endl; return 0; } else { if (a == 0 && b != 0) { ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (a != 0 && b != 0 && c != 0) { long long d = b * b - 4 * a * c; if (d < 0) { cout << 0; return 0; } long double r = sqrt(d), one = 1.0 * (-b - r) / (2 * a), two = 1.0 * ...
8
CPP
import math a, b, c = map(int, input().split()) d = 0 if a == 0 and b == 0 and c == 0: print(-1) exit() if a == 0 and b == 0: print(0) exit() if a == 0: d -= c d /= b print(1) if d == -0: d = 0 print(d) exit() d = b * b - (4 * a * c) if d < 0: print(0) exit() if d...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; int main() { int a, b, c; double delta; double A, B, C; long long aa, bb, cc; while (scanf("%d %d %d", &a, &b, &c) != EOF) { if (a == 0 && b == 0 && c == 0) { printf("-1\n"); continue; } if (a == 0 && b == 0) { ...
8
CPP
#include <bits/stdc++.h> using namespace std; vector<double> roots; int main() { double a, b, c; scanf("%lf%lf%lf", &a, &b, &c); if (a == 0 && b == 0 && c == 0) { printf("-1\n"); return 0; } if (a == 0 && b == 0 && c != 0) { printf("0\n"); return 0; } if (a == 0) { printf("1\n"); p...
8
CPP
#include <bits/stdc++.h> const int N = 200010; const int inf = 0x3f3f3f3f; using namespace std; string str; long long a, b, c; int main() { cin >> a >> b >> c; if (a == 0) { if (c == 0) { if (b == 0) return puts("-1"), 0; printf("1\n0.000000000000\n"); return 0; } else { if (b == 0) ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long double a, b, c, delta, x1, x2; cin >> a >> b >> c; if (a == 0 && b == 0 && c == 0) { cout << -1; return 0; } if (a == 0 && b == 0 && c != 0) { cout << 0; return 0; } if (a == 0 && b != 0) { cout << "1\n" << fixed << setpre...
8
CPP
a, b, c = map(int, input().split()) t = [1, -c / b] if b else [-(c == 0)] if a: d, x = b * b - 4 * a * c, -2 * a if d: t = [0] if d < 0 else [2] + sorted([(b - d ** 0.5) / x, (b + d ** 0.5) / x]) else: t = [1, b / x] print(*t) # Made By Mostafa_Khaled
8
PYTHON3
#include <bits/stdc++.h> using namespace std; const int N = 1e5; const long long INT = 1e9; const long long LONG = 1e18; const long long mod = 1e9 + 7; int main() { double a, b, c; cin >> a >> b >> c; double d = b * b - 4 * a * c; if (a == 0) { if (b == 0) { if (c == 0) cout << -1; else ...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; scanf("%lf%lf%lf", &a, &b, &c); if (a != 0) { double d = b * b - 4 * a * c; if (d > 0) { double x1 = (-b - sqrt(d)) / (2 * a), x2 = (-b + sqrt(d)) / (2 * a); if (x1 > x2) swap(x1, x2); printf("2\n%.9f\n%.9f\n", x1...
8
CPP
import os import sys from io import BytesIO, IOBase import math from queue import Queue import collections import itertools import bisect import heapq #sys.setrecursionlimit(100000) #^^^TAKE CARE FOR MEMORY LIMIT^^^ import random def main(): pass BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { double A, B, C; cin >> A >> B >> C; double a, b, d; if (A == 0 && B == 0 && C == 0) cout << -1; else if (A > 0 || A < 0) { if (B * B > 4 * A * C) { d = B * B - (4 * A * C); a = (-B + sqrt(d)) / (2 * A); b = (-B - sqrt(d)) / (...
8
CPP
import math A, B, C = map(int, input().split(" ")) if A == 0: if B == 0: if C == 0: print(-1) else: print(0) else: print(1) print(-C / B) else: D = B * B - 4 * A * C if D < 0: print(0) elif D == 0: print(1) print(-B / (...
8
PYTHON3
import math a,b,c = [float(x) for x in input().split(' ')] if a == 0: if b == 0: if c == 0: print(-1) else: print("%.10f" %0) else: print(1) print("%.10f" %(-c/b)) else: aux = b ** 2 - 4 * a * c if aux > 0: print(2) arr = [(-b + math.sqrt(aux))/(2 * a), (...
8
PYTHON3
#include <bits/stdc++.h> int nextInt() { int x; scanf("%d", &x); return x; } double nextDouble() { double x; scanf("%lf", &x); return x; } long long nextLong() { long long x; scanf("%I64d", &x); return x; } char nextChar() { char x; scanf("%c", &x); return x; } void newLine() { printf("\n"); } l...
8
CPP
#include <bits/stdc++.h> using namespace std; int main(void) { long double a, b, c, p, q, r; cin >> a >> b >> c; p = b * b - 4 * a * c; if (a == 0 && b == 0 && c == 0) cout << -1 << endl; else if (a == 0 && b == 0 && c != 0) cout << 0 << endl; else if (p < 0) cout << 0 << endl; else if (a == 0...
8
CPP
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long tt = 1; while (tt--) { long long a, b, c; cin >> a >> b >> c; if (a == 0 && b == 0 && c == 0) { cout << -1 << endl; } else if (a == 0 && b == 0) { ...
8
CPP
a,b,c=map(int,input().split()) if a==0: if b==0: if c==0: print(-1) else: print(0) else: print("1\n"+str(-c/b)) else: if b*b==4*a*c: print(1) print("{0:.10f}".format(-b/(2*a))) elif b*b<4*a*c: print(0) else: print(2) ...
8
PYTHON3
a, b, c = [int(i) for i in input().split()] d = b**2 - 4 * a * c if a == 0 and b == 0 and c == 0: print(-1) elif a == 0 and b == 0: print(0) elif a == 0: print(1) print(-c/b) elif d < 0: print(0) elif d == 0: print(1) print(-b / (2 * a)) else: print(2) b = b / a d = d / (a**2) ...
8
PYTHON3
#include <bits/stdc++.h> using namespace std; const bool online_judge = true; const long long inf = 1LL << 60; long long toInt(string s) { long long res; stringstream ss; ss << s; ss >> res; return res; } string toString(long long n) { stringstream ss; ss << n; return ss.str(); } double EPS = 1e-9; void...
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C; cin >> A >> B >> C; if (A == 0) { if (B == 0) { if (C == 0) { cout << -1 << endl; } else { cout << 0 << endl; } } else { double x = -1.0 * C / B; cout << 1 << endl; cout << fix...
8
CPP
from math import * def kv(): q,w,e=map(int,input().split()) if (q==0) & (w==0) & (e==0): print(-1) elif (q==0) & (w==0): print(0) elif q==0: print(1) print("%.6f" % ((-e)/w)) else: d=w*w-4*q*e if d<0: print('0') elif d==0: print('1') prin...
8
PYTHON3