solution stringlengths 11 983k | difficulty int64 0 21 | language stringclasses 2
values |
|---|---|---|
from math import sqrt
abc = input().split()
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
if a == 0:
if b == 0:
if c == 0:
print("-1")
else:
print("0")
else:
print("1")
print(-c/b)
else:
if b**2-4*a*c < 0:
print("0")
elif b**2-4*a*c == 0:... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
double a, b, c, x, x1, x2, d;
int main() {
cin >> a >> b >> c;
d = b * b - 4 * a * c;
if (a == 0 && b == 0 && c != 0) {
cout << 0 << endl;
return 0;
}
if (a == 0 && b == 0 && c == 0) {
cout << -1 << endl;
return 0;
}
if (a == 0 && b != 0) {
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
double a, b, c, d, e, f;
cin >> a >> b >> c;
d = pow(b, 2) - (4 * a * c);
if (d < 0) {
cout << 0;
} else if (a == 0 and b == 0 and c == 0) {
cout << -1 << endl;
} else if (a == 0 and b == ... | 8 | CPP |
#include <bits/stdc++.h>
#pragma GCC target("sse4,avx")
void run(std::istream& in, std::ostream& out) {
int A, B, C;
in >> A >> B >> C;
out.precision(20);
if (A == 0) {
if (B == 0) {
if (C == 0) {
out << -1 << std::endl;
return;
}
out << 0 << std::endl;
return;
}
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
double x1, x2;
cin >> a >> b >> c;
if (a == 0 && b == 0) {
if (c == 0)
printf("-1\n");
else
printf("0\n");
} else if (a == 0 && c == 0) {
printf("1\n0\n");
} else if (b == 0 && c == 0) {
printf("1\n0\n");
... | 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 && b != 0 && c != 0) {
if (((b * b) - (4 * a * c)) == 0) {
printf("1\n");
printf("%lf", -b / (2 * a));
} else if (((b * b) - (4 * a * c)) > 0) {
printf("2\n");
if... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int INF = 2147483647;
const long long LINF = 9223372036854775807;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
double a, b, c;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> a >> b >> c;
if (a == 0) {
if (b !... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long double a, b, c;
cin >> a >> b >> c;
if (a == 0 && b != 0) {
cout << 1 << endl;
long double ans = (long double)(-c / b);
cout << fixed << setprecision(10) << ans << endl;
return 0... | 8 | CPP |
#include <bits/stdc++.h>
int main() {
double a, b, c;
scanf("%lf%lf%lf", &a, &b, &c);
if (a == 0 && b == 0 && c == 0) {
printf("-1");
return 0;
} else if (a == 0 && b == 0) {
printf("0");
return 0;
} else if (b == 0 && c == 0) {
printf("1\n%lf", 0);
return 0;
} else if (a == 0 && c =... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
set<double> s;
double d = b * b - 4 * a * c;
if (d < 0) {
cout << "0" << endl;
} else if (a == 0 && b == 0 && c == 0) {
cout << "-1" << endl;
} else {
double a1, a2;
if (a != 0) {
a1 = (-b ... | 8 | CPP |
from math import *
from decimal import *
getcontext().prec = 10
a, b, c = input().strip().split()
a, b, c = [int(a), int(b), int(c)]
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 d < 0:
print(0)
else:
if a != 0:
res1 = (-b + sqrt(d))/(2*a)
... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
double min(double a, double b) { return a < b ? a : b; }
double max(double a, double b) { return a > b ? a : b; }
int main() {
double a, b, c, x1, x2, dlta;
int num;
while (cin >> a >> b >> c) {
if (a == 0 && b == 0 && c == 0) {
cout << "-1" << endl;
c... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d;
int main() {
scanf("%lld%lld%lld", &a, &b, &c);
if (a) {
if (a < 0) a = -a, b = -b, c = -c;
d = b * b - 4 * a * c;
if (d > 0)
printf("2\n%.10lf\n%.10lf\n", (-b - sqrt((double)d)) / (2 * a),
(-b + sqrt((double)d)) / (2... | 8 | CPP |
#include <bits/stdc++.h>
int main() {
double a, b, c, p, root1, root2;
scanf(" %lf%lf%lf", &a, &b, &c);
if (a != 0) {
p = b * b - 4 * a * c;
if (p < 0)
printf("0\n");
else {
if (p == 0) {
printf("1\n");
root1 = -b / (2 * a);
printf("%.6lf", root1);
} else {
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
using lim = numeric_limits<T>;
template <typename T>
istream& operator>>(istream& is, vector<T>& a) {
for (T& x : a) {
is >> x;
}
return is;
}
int main() {
ios_base::sync_with_stdio(false);
ci... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d;
while (cin >> a >> b >> c) {
d = b * b - 4 * a * c;
if (!a && !b && !c) {
cout << -1 << endl;
continue;
}
if ((!a && !b && c) || d < 0) {
cout << 0 << endl;
continue;
}
if (!a && b) {
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d;
cin >> a >> b >> c;
d = b * b - 4 * a * 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)
printf("1\n%f\n", -(c / b));
else if (d < 0)
printf(... | 8 | CPP |
import math
A, B, C = map(int, input().split())
if A < 0:
A, B, C = -A, -B, -C
if A != 0:
some_num = B * B / (4 * A) - C
if A == 0:
if B == 0 and C == 0:
print(-1)
elif B != 0:
print(1)
print(-C / B)
else:
print(0)
elif some_num > 0:
print(2)
print((-math... | 8 | PYTHON3 |
a,b,c=list(map(float,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:
print(1)
print(-c/b)
elif b*b-4*a*c<0: print(0)
else:
a1,a2=(-b+(b*b-a*4*c)**0.5)/(2*a),(-b-(b*b-a*4*c)**0.5)/(2*a)
if a1==a2:
print(1)
print('{0:.5f}'.format(a1)... | 8 | PYTHON3 |
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("%.6f"%((-c)/b))
else:
d=b*b-4*a*c
if d<0:
print(0)
elif d==0:
print(1)
print("%.6f"%((-b)/(2*a)))
else:
... | 8 | PYTHON3 |
import math
data = [int(x) for x in input().split()]
a = data[0]
b = data[1]
c = data[2]
if a == 0 and b == 0 and c == 0:
print(-1)
elif a == 0 and b == 0:
print(0)
elif a == 0 and b != 0:
print(1)
print(-c/b)
elif (b ** 2) - (4 * a * c) < 0:
print(0)
else:
ans1 = (-b + math.sqrt((b ** 2) - (4 *... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
double d = b * b - a * c * 4;
double x1 = (-b + sqrt(d)) / (2 * a);
double x2 = (-b - sqrt(d)) / (2 * a);
if (d < 0) {
cout << 0;
} else if (a == 0 && b == 0 && c != 0) {
cout << 0;
} else if (a == 0 &... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
using uint = uint32_t;
using ull = uint64_t;
using ld = long double;
using ll = int64_t;
template <typename T>
int cmp(const T &a, const T &b) {
return ((a + 1e-9 < b) ? -1 : ((b + 1e-9 < a) ? 1 : 0));
}
class Task {
private:
ld A, B, C;
void degree2() {
ld sq = ... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, b, c;
double x, s, x1, x2;
long long int l;
while (~scanf("%lld%lld%lld", &a, &b, &c)) {
if (a == 0 && b == 0 && c == 0)
printf("-1\n");
else if (a == 0 && b == 0)
printf("0\n");
else if (b == 0 && c == 0)
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
double a, b, c;
double min(double a, double b) {
if (a > b) return b;
return a;
}
double max(double a, double b) {
if (a < b) return b;
return a;
}
int main() {
double t, x1, x2;
while (scanf("%lf %lf %lf", &a, &b, &c) != EOF) {
if (a == 0 && b == 0 && c == ... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 200005;
vector<long long int> adj[maxn];
long long int a[maxn], jvb[maxn];
int main() {
ios_base::sync_with_stdio(false);
double a, b, c, delta = 0;
cin >> a >> b >> c;
double rt1, rt2;
cout << fixed << setprecision(12);
if (a == 0 && ... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long int r, j, l, x, y, m, c, n, s, f, q, i, z, p, k, d, t, u, e, g, w;
string s1, s2, s3, s4;
int main() {
cin >> x >> y >> z;
if (x == 0) {
if (y == 0) {
if (z == 0)
cout << -1;
else
cout << 0;
} else {
printf("1\n");
... | 8 | CPP |
import math
import time
import sys
import os
from math import gcd, floor, sqrt, log
start_time = time.time()
def iin(): return int(input())
def sin(): return input().strip()
def listin(): return list(map(int, input().strip().split()))
def liststr(): return list(map(str, input().strip().split()))
def ceill(x): return in... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d;
double ans, ans1, ans2;
int main() {
scanf("%I64d %I64d %I64d", &a, &b, &c);
if (a == 0) {
if (b == 0) {
if (c == 0) {
puts("-1");
} else {
puts("0");
}
} else {
puts("1");
ans = (double)(-c) / ... | 8 | CPP |
#include <bits/stdc++.h>
long long A, B, C, D;
int main() {
std ::cin >> A >> B >> C;
D = B * B - 4 * A * 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)
printf("1\n%lf\n", -(double)C / B);
else if (D < 0)
printf("0\n");... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long double a, b, c, x1, x2, d;
cin >> a >> b >> c;
if (a == 0) {
if (b != 0) {
x1 = -c / b;
cout << 1 << endl;
cout.precision(10);
cout << fixed << x1 << endl;
} else if (c == 0)
cout << -1 << endl;
else
co... | 8 | CPP |
import math
a, b, c = map(float, input().split())
d = b * b - 4. * a * c
if d < 0:
print(0)
exit()
if a == 0 and b == 0 and c == 0:
print(-1)
exit()
if a == 0 and b == 0:
print(0)
exit()
if a == 0:
print(1)
print("{0:.6f}".format(-c / b))
exit()
x1 = (-b + math.sqrt(d)) / (2.... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
scanf("%lld%lld%lld", &a, &b, &c);
if (a == 0 && b == 0 && c == 0)
printf("-1\n");
else if (a == 0 && b == 0)
printf("0\n");
else if (a == 0) {
printf("1\n");
printf("%.6lf\n", -1.0 * c / b);
} else if (b * b > 4 *... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
scanf("%I64d%I64d%I64d", &a, &b, &c);
if (a == 0) {
if (b == 0)
printf("%d", (c == 0 ? -1 : 0));
else
printf("1\n%.10f", -1.0 * c / b);
} else {
double res[2];
long long det = b * b - 4 * a * c;
if (det... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int dx[9] = {0, 1, -1, 0, 0, -1, -1, 1, 1};
const int dy[9] = {0, 0, 0, -1, 1, -1, 1, -1, 1};
const double pi = acos(-1.0);
const int N = 1e6 + 100;
const int MOD = 1e9 + 7;
long long a, b, c;
double temp;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> a... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
double a, b, c;
struct node {
double x1, x2;
int n;
} cx;
node solve() {
node ax;
if (a == 0 && b == 0 && c == 0) {
ax.n = -1;
return ax;
}
if (a == 0 && b == 0 && c != 0) {
ax.n = 0;
return ax;
}
if (a == 0 && b != 0 && c != 0) {
ax.n = ... | 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;
if (a == 0 && b == 0 && c != 0) cout << 0;
if (a != 0 && b != 0) {
long long int d = b * b - 4 * a * c;
if (d < 0) cout << 0;
if (d > 0) {
cout << 2... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
a = double(a);
b = double(b);
c = double(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) {
c... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
long long iA, iB, iC, iDelta;
double iX1, iX2;
cin >> iA >> iB >> iC;
if (iA == 0) {
if (iB == 0 && iC == 0) {
cout << -1;
goto endapp;
} else if (iB == 0 && iC != 0) {
cout << 0;
goto endap... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
signed long long tonum(string s) {
stringstream in(s);
signed long long x;
in >> x;
return x;
}
string tostr(signed long long n) {
stringstream in;
in << n;
string x;
in >> x;
return x;
}
signed long long gcd(signed long long a, signed long long b) {
whi... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
double p, q;
while (cin >> a >> b >> c) {
if (a == 0 && b == 0 && c == 0)
cout << -1 << endl;
else if (a == 0 && b == 0 && c != 0)
cout << 0 << endl;
else if (a == 0) {
if (b != 0 && c == 0) {
cout << ... | 8 | CPP |
import sys
import math
input = sys.stdin.readline
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
if __name__ == '__main__':
q = inlt()
a = q[0]
b = q[1]
c = q[2]
if a == 0 :
if b == 0 and c == ... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long A, B, C;
cin >> A >> B >> C;
if (!A) {
if (!B) {
if (!C)
cout << -1;
else
cout << 0;
return 0;
}
cout << 1 << '\n';
cout << fixed << setprecision(10) << (long double)-C / B;
return 0;
}
l... | 8 | CPP |
a,b,c = map(int, input().split())
D = int(b*b - 4*a*c)
if a == 0 and b ==0 and c == 0:
print(-1)
else:
if D > 0 and a != 0:
print(2)
if -(b+D**0.5)/(2*a) < -(b-D*00.5)/(2*a):
print(-(b+D**0.5)/(2*a))
print(-(b-D**0.5)/(2*a))
else:
print(-(b-D**0.5... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d, x1, x2;
cin >> a >> b >> c;
d = (b * b) - 4 * a * c;
if (a == 0 && b == 0 && c == 0)
cout << "-1\n";
else if (a == 0 && b == 0)
cout << "0\n";
else if (d < 0)
cout << "0\n";
else if (a == 0) {
cout << "1\n";
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d, x1, x2;
cin >> a >> b >> c;
if ((a == 0) && (b == 0) && (c == 0)) {
cout << -1;
goto l;
}
if ((a == 0) && (b == 0)) {
cout << 0;
goto l;
}
if (a == 0) {
cout << "1\n";
printf("%.6f", -c / b);
goto l;
... | 8 | CPP |
# http://codeforces.com/problemset/problem/20/B
from math import sqrt
a, b, c, = [int(x) for x in input().split(' ')]
def number_solutions(a, b, c):
d = b**2 - 4*a*c
if a == 0 and b == 0 and c != 0:
return 0
elif a == 0 and b == 0 and c == 0:
return -1
elif a == 0 and b != 0:
... | 8 | PYTHON3 |
#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;
return 0;
}
if (a == 0 && b == 0) {
cout << 0;
return 0;
}
if (a == 0) {
cout << 1 << endl << fixed << setpre... | 8 | CPP |
#include <bits/stdc++.h>
const double eps = 1e-6;
int main() {
double a, b, c;
while (std::cin >> a >> b >> c) {
if (fabs(a) < eps) {
if (fabs(b) < eps) {
if (fabs(c) > eps) {
puts("0");
} else {
puts("-1");
}
} else {
double ans = -c / b;
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a;
double b;
double c;
cin >> a;
cin >> b;
cin >> c;
double D = (b * b) - (4 * a * c);
double x = (sqrt(D) - b) / (2 * a);
double y = (-(sqrt(D)) - b) / (2 * a);
double z = ((-1) * c) / b;
if (a == 0 && b == 0 && c == 0) {
cout ... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
cout << fixed << setprecision(9);
long long a, b, c;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
cout << (c == 0 ? -1 : 0) << '\n';
return 0;
}
cout << "1\n";
cout << (double)(-c) / b << '\n';
return 0;
}
long lon... | 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;
int main() {
double a, b, c, d, r1, r2;
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) {
cout << "1" << endl;
r1 = -c / b;
printf("%5f", r1);
} else {
d = b * b -... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
double min(double a, double b) { return a < b ? a : b; }
double max(double a, double b) { return a > b ? a : b; }
int main() {
double a, b, c;
scanf("%lf%lf%lf", &a, &b, &c);
double t = b * b - 4 * a * c;
if (t < -1e-9) {
puts("0");
return 0;
} else if (t ... | 8 | CPP |
from math import sqrt
def equation(a, b, c):
if a != 0:
d = b ** 2 - 4 * a * c
if d > 0 and a > 0:
x1 = (-b - sqrt(d)) / (2 * a)
x2 = (-b + sqrt(d)) / (2 * a)
return 2, x1, x2
elif d > 0 and a < 0:
x1 = (-b + sqrt(d)) / (2 * a)
x2... | 8 | PYTHON3 |
import math
A,B,C = map(int,input().split())
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('%5.5f'%x)
elif D<0:
print(0)
elif D>0:
print(2)
x1=(-B+math.sqrt(D))/(2*A)
x2=(-B-math.sqrt(D))/(2*A)
if x... | 8 | PYTHON3 |
import math
def solve_const(x):
if(x == 0):
print(-1)
else:
print(0)
def solve_lineal(x, y):
if(y == 0):
#yt = 0 => t = 0
print(1)
print(0)
else:
#xt + y = 0 => t = -y/x
print(1)
print(-y / x)
def solve_square(x, y, z):
d = y * y - 4 * x * z
if(d < 0):
print(0)
elif(d > 0):
print(2)
x1 =... | 8 | PYTHON3 |
a, b, c = map(int, input().split())
if a == 0 and b == 0:
print('0' if c else '-1')
elif a == 0:
print('1', -c / b, sep='\n')
else:
d, x = b ** 2 - 4 * a * c, 2 * a
if d < 0:
print('0')
elif d == 0:
print('1', -b / x, sep='\n')
else:
r = sorted(((-b + d ** 0.5) / x, (-b -... | 8 | PYTHON3 |
a,b,c = [int(x) for x in input().split()]
if a == 0 and b == 0 and c == 0:
print(-1)
elif a == 0:
if b == 0:
print(0)
else:
print(1)
print(-c/b)
else:
disc = b**2 - 4*a*c
denom = 2*a
if disc == 0:
print(1)
print(-b/denom)
elif disc < 0:
print(... | 8 | PYTHON3 |
a, b, c = map(int, input().split())
if a < 0:
a = -a
b = -b
c = -c
x = (b**2)-(4*a*c)
if a == 0:
if b == 0:
if c == 0:
print(-1)
else:
print(0)
else:
print(1)
print(f'{-c*1.0/b:.7f}')
elif x == 0:
print(1)
print(f'{-b/(2*a):.7f}')
eli... | 8 | PYTHON3 |
import math
A, B, C = [int(i) for i in input().split()]
X = 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:
print(1)
print('{0:.10f}'.format(-C / B, 6))
elif X < 0:
print(0)
elif X == 0:
print(1)
print('{0:.10f}'.format(-B / (2... | 8 | PYTHON3 |
R=lambda: map(int,input().split())
a,b,c=R()
if a==0 and b==0 and c==0:
print("-1")
elif (b**2)<4*a*c:
print("0")
elif a==0:
if b==0:
print("0")
else:
print("1")
print("{0:.5f}".format(-(c/b)))
else:
d= (b**2)-4*a*c
r1= (-b+pow(d,0.5))/(2*a)
r2= (-b-pow(d,0.5))/... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, n, line;
double A, B, C, x1, x2, mid;
cin >> A >> B >> C;
mid = (B * B) - (4 * A * C);
if (A == 0 && B == 0 && C == 0) {
printf("-1\n");
} else if (A == 0 && B == 0)
printf("0\n");
else if (mid < 0.0)
printf("0\n");
else if... | 8 | CPP |
a, b, c = map(int,input().split())
if a != 0:
if b**2-4*a*c >= 0:
root1 = (-b + (b**2-4*a*c)**0.5)/(2*a)
root2 = (-b - (b**2-4*a*c)**0.5)/(2*a)
list = [root1, root2]
if root1 == root2:
print(1)
print(root1)
else:
print(2)
print(... | 8 | PYTHON3 |
x,y,z=[int(i) for i in input().split()]
a=y**2-4*x*z
if x==0 and y==0 and z==0:
print(-1)
elif x==0 and y==0:
print(0)
elif x==0:
print(1)
print(-z/y)
elif a<0:
print(0)
elif a==0:
print(1)
print(-y/(2*x))
else:
print(2)
y=y/x
a=a/(x**2)
print((-y-a**0.5)/2)
print((-y+a**... | 8 | PYTHON3 |
import math
a,b,c=map(int,input().split())
if a==0:
if b==0 and c!=0:
print(0)
elif b==0 and c==0:
print(-1)
else:
x=-c/b
print(1)
print("%.10f" %x)
else:
d=b*b-4*a*c
if d<0:
print(0)
else:
if d>0:
ans=[]
ans.append(... | 8 | PYTHON3 |
import math
a,b,c = list(map(int, input().split(" ")))
if a == 0 and b == 0 and c == 0:
print(-1)
elif a == 0 and b != 0:
print(1)
print('{0:.5f}'.format(-c/b))
elif a == 0 and b == 0 and c != 0:
print(0)
else:
d = b**2 - 4 * a * c
if d > 0:
x1 = (-b + math.sqrt(d))/(2*a)
x2 = (-b - math.sqrt(d))/(2*a)
if x... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long a, b, c, d;
long double k, x1, x2;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0)
c == 0 ? cout << -1 : cout << 0;
else
cout << "1\n" << fixed << setprecision(10) << (double)(-c)... | 8 | CPP |
import math
A, B, C = input().split()
A, B, C = float(A), float(B), float(C)
if A == 0 and B == 0:
if C == 0:
print(-1)
else:
print(0)
elif A == 0:
print(1)
print("%.10f" % (-C / B))
else:
det = B * B - 4 * A * C
if det < 0:
print(0)
elif det == 0:
print(1)
x = -B / (2 * A)
print("%.10f" % x)
else:
... | 8 | PYTHON3 |
from math import sqrt
a,b,c=map(int,input().split())
if a==b==c==0:
print(-1)
elif a==b==0:
print(0)
elif a==0:
print(1)
print(-c/b)
else:
if b**2==(4*a*c):
print(1)
print((-b)/(2*a))
elif (4*a*c)>b**2:
print(0)
else:
print(2)
x=((-b+sqrt(b**2-(4*a*... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, x, y, r1, r2, m, n;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
if (c == 0)
printf("-1");
else
printf("0");
} else {
x = -1 * (c / b);
printf("1\n%.5lf", x);
}
} else {
y = b * ... | 8 | CPP |
import math
a, b, c=input().split()
a=int(a)
b=int(b)
c=int(c)
if ((a!=0 and b*b<4*a*c) or (a==b==0 and c!=0)): print ('0')
elif (a==b==c==0): print('-1')
elif (a==0):
print('1')
a1=-c/b
print (format(a1, '.5f'))
else:
a1=(-b-(b*b-4*a*c)**.5)/(2*a)
a2=(-b+(b*b-4*a*c)**.5)/(2*a)
if a1... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long a, b, c;
cin >> a >> b >> c;
if (!a && !b && !c) {
cout << -1;
return 0;
}
if (!a && !b && c) {
cout << 0;
return 0;
}
if (!a) {
cout << 1 << '\n'... | 8 | CPP |
__author__ = 'linh'
import math
def main():
n = input().split()
A = int(n[0])
B = int(n[1])
C = int(n[2])
if A==B==C==0:
print(-1)
elif A==B==0:
print(0)
elif A==0:
print(1)
print("{0:.5f}".format(-C/B))
else:
delta = B**2 -4*A*C
if delt... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c, numberOfRoots, temp;
double r1, r2;
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 if (a == 0) {
r1 = doub... | 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) {
if (b == 0) {
if (c == 0)
cout << -1 << endl;
else
cout << 0 << endl;
} else
cout << 1 << endl << fixed << setprecision(10) << (dou... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c, d;
cin >> a >> b >> c;
if (a == 0 && b == 0 && c == 0) {
cout << "-1" << endl;
} else {
if (a == 0) {
if (b != 0) {
cout << "1" << endl;
cout << fixed << setprecision(5) << (0 - c) / (1.0 * b) << endl;
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d, e, f, g;
cin >> a >> b >> c;
if (a == 0 && b == 0 && c == 0) {
cout << "-1";
return 0;
}
if (a == 0 && b == 0) {
cout << "0" << endl;
return 0;
}
if (a == 0) {
cout << "1" << endl;
cout << std ::fixed;
... | 8 | CPP |
import math
a, b, c = map(int, input().split())
delta = (b*b) - (4*a*c)
# print(delta)
if delta < 0:
print("0")
# elif a+b+c == 0:
# print("-1")
else:
if a != 0:
x1 = (-b + math.sqrt(delta))/(a*2)
x2 = (-b - math.sqrt(delta))/(a*2)
if delta == 0:
print("1")
p... | 8 | PYTHON3 |
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
from math import sqrt
def main():
a,b,c = map(int,input().split())
if a == b == c == 0:
print(-1)
elif a == b == 0:
print(0)
elif a == 0:
print(1)
print('%.10f'%(-c... | 8 | PYTHON3 |
from math import *
a=[int(i) for i in input().split()]
if(a[0]==0 and a[1]==0 and a[2]==0):
print("-1")
exit()
if(a[0]==0 and a[1]!=0):
print("1")
print((-a[2])/a[1])
elif(a[0]==0 and a[1]==0):
print("0")
exit()
else:
if((a[1]*a[1]-4*a[0]*a[2])<0):
print("0")
elif((a[1]*a[1]-4*a... | 8 | PYTHON3 |
import math
a,b,c=map(int,input().split())
if a:
if b*b-4*a*c>0:
print(2)
print(min((-b-math.sqrt(b*b-4*a*c))/2/a,(-b+math.sqrt(b*b-4*a*c))/2/a))
print(max((-b-math.sqrt(b*b-4*a*c))/2/a,(-b+math.sqrt(b*b-4*a*c))/2/a))
elif b*b-4*a*c==0:
print(1)
print(round(-b/2/a,5))
... | 8 | PYTHON3 |
import math
def solver(a, b, c):
d = b**2-4*a*c
if a == 0 and b!=0:
print('1')
print('%.5f'%(-c/b))
elif a == 0 and b == 0 and c == 0:
print(-1)
elif a == 0 and b == 0 and c!=0:
print('0')
elif d < 0:
print(0)
elif d == 0 and (a!= 0):
x1 = (-b + ma... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void roots(double a, double b, double c) {
double x1, x2;
double p = b * b - 4 * a * c;
if (a == 0 && b == 0 && c == 0)
cout << -1 << endl;
else if (p < 0 || a == 0 && b == 0)
cout << 0 << endl;
else if (a == 0) {
cout << 1 << endl;
cout << fixed <... | 8 | CPP |
a, b, c = map(int, input().split())
if a == 0: # line
if b == 0: # horizontal line
if c == 0: # along x axis
print(-1)
else:
print(0)
else: # slanted line
print(1)
print(-c / b)
else: # parabola
square = b*b - 4*a*c
if square < 0: # complex roots
print(0)
elif square =... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
while (cin >> a >> b >> c) {
if (a != 0) {
if (b * b - 4 * a * c < 0)
cout << 0 << endl;
else if (b * b - 4 * a * c == 0) {
printf("%d\n", 1);
printf("%.10lf\n", -b / (2 * a));
} else if (b * b -... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
cin >> a >> b >> c;
double ad = a;
double bd = b;
double cd = c;
if (a == 0 && b == 0 && c == 0) {
cout << -1 << endl;
return 0;
}
if (a == 0) {
if (b == 0) {
cout << 0 << endl;
return 0;
}
prin... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
double n, m, k, a, b, c;
string s;
vector<double> v;
int main() {
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 (b * b - 4 * a * c <... | 8 | CPP |
#include <bits/stdc++.h>
int a, b, c;
void solver() {
if (a == 0 && b != 0) {
printf("1\n%.5f\n", (-c / (float)b));
return;
}
if (a == 0 && b == 0 && c == 0) {
printf("-1\n");
return;
}
if ((a == 0 && b == 0 && c != 0) || (a == b && b == c) ||
(b == 0 && a * c > 0)) {
printf("0\n");
... | 8 | CPP |
import re
arr = re.split(' ', input())
A = int(arr[0])
B = int(arr[1])
C = int(arr[2])
dis = 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):
print(1)
print(-C/B)
elif (dis<0):
print(0)
elif (dis==0):
print(1)
print(-B/(2*A))
else:
... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MAX1 = 0x7f7f7f7f;
const int MAX = 1e5 + 10;
double exgcd(long long l, long long r, double &x, double &y) {
if (r == 0) {
x = 1;
y = 0;
return l;
} else {
double d = exgcd(r, l % r, y, x);
y -= l / r * x;
return d;
}
}
int main() {
... | 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;
else if (a == 0 && b == 0 && c != 0)
cout << 0;
else if (b * b - 4 * a * c < 0)
cout << 0;
else if (a == 0) {
cout << 1 << endl;
double x = -(c / b);... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int const uu[4] = {1, -1, 0, 0};
int const vv[4] = {0, 0, 1, -1};
int const inf = 0x3f3f3f3f;
long long const INF = 0x7fffffffffffffffll;
double eps = 1e-10;
double pi = acos(-1.0);
double a, b, c;
int main() {
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
i... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
if (c == 0)
cout << -1 << endl;
else
cout << 0 << endl;
} else {
cout << 1 << endl;
printf("%.9lf\n", -c / b);
}
} else {
if (b * b -... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
scanf("%lld%lld%lld", &a, &b, &c);
if (a == 0 && b == 0 && c == 0)
printf("%d", -1);
else if (a == 0 && b == 0 && c != 0)
printf("%d", 0);
else if (a == 0 && b != 0)
printf("1\n%.10lf", -double(c) / b);
else {
if (... | 8 | CPP |
R=lambda:map(int,input().split())
(a,b,c) = R()
if b:
t = [1,-c/b]
else:
t = [-(c==0)]
if a:
(d,x) = ((b*b)-(4*a*c),-2*a)
if d:
if d < 0:
t = [0]
else:
t = [2] + sorted([(b - d ** 0.5) / x, (b + d ** 0.5)/x])
else:
t = [1,b/x]
if len(t)==1:
print(*t)
elif len(t)==2:
print(t[0])
print('%.10f'%t[1... | 8 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
float dir, x1, x2;
int count;
while (cin >> a >> b >> c) {
if (a == 0 && b == 0 && c == 0)
cout << "-1" << endl;
else if (a == 0) {
if (b == 0)
cout << "0" << endl;
else {
cout << "1" << endl;... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
if (c == 0)
cout << -1;
else
cout << 0;
} else
cout << fixed << setprecision(5) << "1\n" << -c / b;
} else {
double denta = b * b - 4 * a * c;
... | 8 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
double a, b, c;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0 && c == 0) {
cout << "-1" << endl;
return 0;
}
if (b == 0 && c != 0) {
cout << "0" << endl;
return 0;
}
cout << "1... | 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.0) {
if (b == 0.0) {
if (c == 0.0)
cout << "-1" << endl;
else
cout << "0" << endl;
return 0;
}
cout << "1" << endl;
cout << fi... | 8 | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.