text stringlengths 49 983k |
|---|
#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... |
#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 *... |
#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... |
#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... |
#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 = ... |
#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... |
#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... |
#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... |
#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... |
#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 << ... |
#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... |
#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";
... |
#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;
... |
#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... |
#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;
... |
#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 ... |
#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... |
#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 == ... |
#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 -... |
#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 ... |
#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... |
#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)... |
#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 * ... |
#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'... |
#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... |
#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... |
#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;
... |
#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;
... |
#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 <... |
#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 -... |
#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... |
#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 <... |
#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");
... |
#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() {
... |
#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);... |
#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... |
#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 -... |
#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 (... |
#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;... |
#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;
... |
#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... |
#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... |
#include <bits/stdc++.h>
using namespace std;
double a, b, c, a1, a2, mini;
int n, i, j;
int main() {
cin >> a >> b >> c;
if (!a && !b) {
if (!c)
cout << "-1";
else
cout << "0";
return 0;
}
if (!a) {
a1 = (-c) / b;
printf("1\n%lf", a1);
return 0;
}
if ((b * b < (4 * a * c... |
#include <bits/stdc++.h>
using namespace std;
double a, b, c;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
scanf("%lf%lf%lf", &a, &b, &c);
if (a == 0) {
if (b == 0 && c == 0)
cout << -1;
else if (b == 0)
cout << 0 << endl;
else
printf("1\n%.10lf", -c / b);
} else {
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
float a, b, c;
cin >> a >> b >> c;
float 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(6) << -c / ... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, d;
double x1, x2;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
if (c == 0)
cout << -1 << endl;
else
cout << 0 << endl;
} else
printf("1\n%f\n", -1 * c / b);
} else {
d = b * b - 4 * a * ... |
#include <bits/stdc++.h>
using namespace std;
long double x = 0, y = 0, l = 0;
long long int a = 0, b, c;
int main() {
cin >> a >> b >> c;
x = (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;
}
cout.precision(6);
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b, c;
cin >> a >> b >> c;
long long DIS = (b * b) - (4 * a * c);
if ((a == 0 and b == 0 and c == 0))
cout << -1 << endl;
else if (DIS < 0 or (a == 0 and b == 0))
cout << 0 << endl;
else if (a == 0)
printf("1\n%.10lf\n", (dou... |
#include <bits/stdc++.h>
using namespace std;
double a, b, c;
int main() {
while (scanf("%lf%lf%lf", &a, &b, &c) != EOF) {
double jd = b * b - 4 * a * c;
if (a == 0) {
if (b == 0)
printf("%d\n", c == 0 ? -1 : 0);
else
printf("1\n%.10lf\n", (double)-c / (double)b);
} else if (jd... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
while (~scanf("%lf%lf%lf", &a, &b, &c)) {
if (a == 0 && b == 0)
if (c == 0)
puts("-1");
else
puts("0");
else if (a == 0 && c == 0)
puts("1\n0");
else if (b == 0 && c == 0)
puts("1\n0");
... |
#include <bits/stdc++.h>
using namespace std;
bool SR(int &x) { return scanf("%d", &x) == 1; }
bool SR(long long &x) { return scanf("%lld", &x) == 1; }
bool SR(double &x) { return scanf("%lf", &x) == 1; }
bool SR(char *s) { return scanf("%s", s) == 1; }
bool RI() { return true; }
template <typename I, typename... T>
bo... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF32 = INT_MAX;
const ll INF64 = ((ll)INF32 << 29ll);
void reflex() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
}
signed main() {
reflex();
using ld = long double;
ld a, b, c... |
#include <bits/stdc++.h>
using namespace std;
double a, b, c;
int main() {
cin >> a >> b >> c;
if (a == 0 && b == 0 && c == 0) {
cout << "-1" << endl;
return 0;
}
if (a == 0) {
if (b == 0)
cout << "0" << endl;
else {
cout << "1" << endl;
double x = -c / b;
cout.precision(... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, det, x1, x2;
while (scanf("%lf%lf%lf", &a, &b, &c) != EOF) {
if (a == 0 && b == 0) {
if (c == 0)
puts("-1");
else
puts("0");
continue;
}
if (a == 0) {
x1 = -1.0 * c / b;
if (x1 == -0.... |
#include <bits/stdc++.h>
using namespace std;
inline long long int max(long long int a, long long int b, long long int c) {
return max(max(a, b), c);
}
inline long long int min(long long int a, long long int b, long long int c) {
return min(min(a, b), c);
}
inline long long int max(long long int a, long long int b)... |
#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 == ... |
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
double a, b, c;
cin >> a >> b >> c;
if (a == 0 && b == 0) {
if (c == 0) {
cout << -1 << endl;
} else {
cout << 0 << endl;
}
return 0;
}
if (a == 0) {
cout << 1 << endl;
printf("%.6f\n", 0... |
#include <bits/stdc++.h>
using namespace std;
int TestMillerRabin[12] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37};
long long mulmod(long long a, long long b, long long p) {
long long x = 0, y = a % p;
while (b > 0) {
if (b % 2 == 1) x = (x + y) % p;
y = (1LL * y * 2) % p;
b = b / 2;
}
return x % ... |
#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) {
printf("-1");
} else {
printf("0");
}
} else {
printf("1\n%f", -c / b);
}
} else {
if (b * b - 4 * a * c < -1E-6) {
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
double x[3];
cin >> a >> b >> c;
if (a == 0 && b == 0 && c == 0) {
cout << "-1" << endl;
return 0;
}
if (a == 0 && b == 0) {
cout << "0" << endl;
return 0;
}
if (a == 0) {
cout << "1" << endl;
cout << fixe... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c, det, x1, x2;
cout.precision(15);
cin >> a >> b >> c;
det = b * b - 4 * a * c;
if (a == 0 && b == 0 && c == 0)
cout << -1;
else if (a == 0 && b == 0 || det < 0)
cout << 0;
else if (a == 0)
cout << 1 << endl << -c / b;
... |
#include <bits/stdc++.h>
int main() {
double a, b, c;
scanf("%lf %lf %lf", &a, &b, &c);
if (a == 0) {
if (b == 0) {
puts(c ? "0" : "-1");
} else {
printf("1\n%.6lf\n", -c / b);
}
} else {
if (a < 0) {
a = -a;
b = -b;
c = -c;
}
double d = b * b - 4 * a * c;
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
double f;
if (a == 0 && b == 0) {
if (c == 0)
cout << "-1" << endl;
else
cout << "0" << endl;
} else if (a == 0 && c == 0) {
cout << "1" << endl;
cout << fixed << setprecision(8) << 0.0 <... |
#include <bits/stdc++.h>
int main() {
long long a, b, c, d;
scanf("%lld %lld %lld", &a, &b, &c);
if (a == 0 && b == 0 && c == 0) {
printf("-1");
return 0;
}
if (a == 0 && b == 0) {
printf("0");
return 0;
}
d = b * b - 4 * a * c;
if (d < 0) {
printf("0");
return 0;
}
if (a == ... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
double a, b, c;
cin >> a >> b >> c;
if (a == 0 && b == 0 && c == 0) {
cout << -1;
return 0;
} else if (a == 0 && b == 0) {
cout << 0;
return 0;
}
if (a == 0) {
cout << 1 << endl... |
#include <bits/stdc++.h>
using namespace std;
int main() {
float a, b, c, zero = 0, count = 0;
cin >> a >> b >> c;
if (a != 0) {
float z = (b * b) - (4 * a * c);
if (z > -1) {
if (b == 0 && c == 0) {
cout << 1 << endl << setprecision(10) << fixed << 0 << endl;
return 0;
} else ... |
#include <bits/stdc++.h>
using namespace std;
void SieveOfEratosthenes(long long n) {
bool prime[n + 1];
memset(prime, true, sizeof(prime));
for (long long p = 2; p * p <= n; p++) {
if (prime[p] == true) {
for (long long i = p * p; i <= n; i += p) prime[i] = false;
}
}
}
long long power(long long ... |
#include <bits/stdc++.h>
using namespace std;
double a, b, c;
int main() {
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
if (c == 0)
cout << -1;
else
cout << 0;
} else {
cout << 1 << endl;
double x = -c / b;
printf("%.8f", x);
}
} else {
double D = b... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
double f = 0, g = 0, i = 0;
cin >> a >> b >> c;
f = ((-1 * b + sqrt((b * b) - (4 * a * c))) / (2 * a));
g = ((-1 * b - sqrt((b * b) - (4 * a * c))) / (2 * a));
i = ((-1 * c) / b);
if (a == 0 && b != 0) {
cout << 1 << endl << fi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double A, B, C;
double d, x1, x2;
cin >> A >> B >> C;
cout << fixed << setprecision(10);
if (A == 0) {
if (B == 0) {
if (C == 0) {
cout << -1;
} else {
cout << 0;
}
} else {
cout << 1 << endl;
cout... |
#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
double A, B, C;
double eps = 1e-9;
cin >> A >> B >> C;
double D = B * B - 4.0 * A * C;
if (fabs(A) < eps) {
if (fabs(B) < eps) {
if (fabs(C) < eps)
cout << "-1";
else
cout << "0";
} else {
... |
#include <bits/stdc++.h>
using namespace std;
long long delta(long long a, long long b, long long c) {
return b * b - 4 * a * c;
}
int main() {
long long a, b, c;
scanf("%I64d%I64d%I64d", &a, &b, &c);
if (a == 0 && b == 0 && c == 0) {
puts("-1");
return 0;
} else if (a == 0 && b == 0 && c != 0) {
... |
#include <bits/stdc++.h>
using namespace std;
double delta(long long a, long long b, long long c) {
long long res = 0;
res = b * b - 4 * a * c;
return res;
}
int main() {
int n;
double a, b, c;
double r1, r2;
cin >> a >> b >> c;
if (a == 0) {
n = (b == 0) ? 0 : 1;
r1 = (b == 0) ? 0 : -c / b;
... |
#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)
printf("-1\n");
else if (a == 0 && b == 0 && c)
printf("0\n");
else if (a == 0)
printf("1\n%.10lf\n", -c / b);
else if (b == 0) {
if (c < 0) printf("2\n%... |
#include <bits/stdc++.h>
using namespace std;
const long double EPS = (long double)1e-7;
const long double PI = acos(0) * 2;
bool isZero(const long double& x) { return abs(x) <= EPS; }
int sign(const long double& x) { return isZero(x) ? 0 : (0 < x ? 1 : -1); }
long long gcd(long long a, long long b) {
for (; b; a %= ... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b, c;
double res1, res2;
cin >> a >> b >> c;
if (a == 0) {
if (b == 0) {
if (c == 0)
cout << "-1\n";
else
cout << "0\n";
} else {
cout << "1\n";
cout << fixed << setprecision(10) << (-c / b) << e... |
#include <bits/stdc++.h>
struct edge {
int to;
edge* next;
} E[6010], *ne = E, *first[3010];
void link(int a, int b) {
*ne = (edge){b, first[a]};
first[a] = ne++;
}
int C[3010], cnt;
bool tag[3010];
int dfs1(int i, int f) {
int t;
tag[i] = 1;
for (edge* e = first[i]; e; e = e->next)
if (e->to != f) {
... |
#include <bits/stdc++.h>
using namespace std;
int vi[3005], cir;
int ori[3005][3005];
int sccl[3005][3005];
vector<int> s[3005], scc[3005], g[3005];
stack<int> sta;
int dfs_cnt = 0, pre[3005] = {0}, sccno[3005] = {0}, scc_cnt = 0;
int dfs(int u, int fa) {
int lowu, lowv, i;
lowu = pre[u] = ++dfs_cnt;
sta.push(u);... |
#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
;
int n, x, y, cnt[4000], vis[4000], circle[4000], Cnt, top;
double ans;
vector<int> E[4000];
void check(int S, int u, int dis) {
vis[u] = 1;
for (int i = (0); i < (E[u].size()); ++i)
if (!vis[E[u][i]])
... |
#include <bits/stdc++.h>
using namespace std;
double ans;
int d[3005], lp[3005], bl[3005], vst[3005], lc[3005][3005], dep[3005], cnt,
fa[3005], pos[3005];
vector<int> son[3005];
queue<int> q;
void dfs(int now) {
vst[lp[pos[now] = ++cnt] = now] = 2;
for (int T, i = 0; i < son[now].size(); ++i)
if (!vst[T = s... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void in(T &x) {
x = 0;
short f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
x *= f;
}
template <class T>
inlin... |
#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
vector<int> to[N];
int f[N][15], st[N], top, cir[N], dep[N], col[N], n, cnt, siz, vis[N], oncir[N];
void add(int a, int b) {
to[a].push_back(b);
to[b].push_back(a);
}
int find(int now, int fa) {
if (vis[now]) {
int v;
do {
v = st[top-... |
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
namespace _buff {
const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
if (ib == ie) {
ib = ibuf;
ie = ibuf + fread(ibuf, 1, BUFF, stdin);
}
return ib == ie ? -1 : *ib++;
}
} // namespace _buff
LL read() {
... |
#include <bits/stdc++.h>
const int maxn = 3005;
const int maxm = 6005;
const int inf = 999999999;
struct edge {
int to, next;
};
int n;
edge e[maxm];
int head[maxn], tot;
int stn[maxn], stk[maxn], top = 1;
int cir[maxn], circ, ind[maxn];
int cirr[maxn];
bool vis[maxn];
int dis[maxn][maxn];
bool vis2[maxn][maxn];
void... |
#include <bits/stdc++.h>
using namespace std;
static const int maxn = 3000 + 5;
static const int maxm = 6000 + 5;
static int n, c;
static int suf[maxn], pre[maxm], tar[maxm], e;
static int vis[maxn], dep[maxn], dis[maxn];
static int deg[maxn], que[maxn], head, tail;
static double ans;
inline int read() {
int k = 0, f... |
#include <bits/stdc++.h>
using namespace std;
vector<int> v[3005];
bool vis[3005], cir[3005];
int q, s, n;
int Find_Cir(int x, int y) {
vis[x] = 1;
for (int i = 0; i < v[x].size(); i++)
if (!vis[v[x][i]]) {
int t = Find_Cir(v[x][i], x);
if (t) {
if (t > 0) {
cir[x] = 1;
s... |
#include <bits/stdc++.h>
const int N = 3e3 + 10;
int n, vis[N], px, py, dep[N], fa[12][N], id[N], flag[N], lg[N];
std::vector<int> e[N], x, y;
int main() {
scanf("%d", &n);
for (int i(2); i < N; ++i) {
lg[i] = lg[i / 2] + 1;
}
for (int i(1), x, y; i <= n; ++i) {
scanf("%d %d", &x, &y);
++x;
++y;... |
#include <bits/stdc++.h>
using namespace std;
const int N = 3000 + 3;
struct Edge {
int to, nxt;
} e[N << 1];
int n, cnt;
int hd[N], top, q[N], tail, cur[N], c[N], pos[N], belong[N], dep[N], dis[N];
bool vis[N], used[N];
long double ans;
inline void addedge(int x, int y) {
e[++top].to = y;
e[top].nxt = hd[x];
h... |
#include <bits/stdc++.h>
using namespace std;
inline bool SR(int &x) { return scanf("%d", &x) == 1; }
inline bool SR(long long &x) { return scanf("%lld", &x) == 1; }
inline bool SR(double &x) { return scanf("%lf", &x) == 1; }
inline bool SR(char *s) { return scanf("%s", s) == 1; }
inline bool RI() { return true; }
temp... |
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int nxt, to;
} e[6005];
int hd[3005], e_cnt;
void add(int u, int v) {
e[++e_cnt] = (Edge){hd[u], v};
hd[u] = e_cnt;
}
int n, dia[3005], dia_cnt, rec[3005];
double ans;
bool vis[3005];
void dfs1(int u, int r, int dep) {
vis[u] = true;
rec[dep] = u;
... |
#include <bits/stdc++.h>
using namespace std;
int n;
struct Edge {
int to, next;
};
const int maxn = 6060;
Edge e[maxn];
int st[maxn], tot = -1;
void add(int u, int v) {
e[++tot].to = v;
e[tot].next = st[u];
st[u] = tot;
}
bool vis[3030], cir[maxn];
int fa[maxn], dep[maxn], C;
void prep(int now) {
for (int i ... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 3) + (x << 1) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
const int... |
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int to, next;
} e[6060];
int point[3030], te = 1;
void addE(int st, int ed) {
te++;
e[te].to = ed;
e[te].next = point[st];
point[st] = te;
}
int ind[3030];
queue<int> q;
int ter, cir;
int vis[3030], dis[3030], dis2[3030];
double ans;
void dfs(int now... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(register T& t) {
register T f = 1;
register char ch = getchar();
t = 0;
while (ch < '0' || ch > '9') {
if (ch == '-') f = -f;
ch = getchar();
}
while (ch >= '0' && ch <= '9') t = t * 10 + ch - '0', ch = getchar();
t ... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x20202020;
const int mod = 1000000007;
template <class T>
inline void read(T& x) {
bool fu = 0;
char c;
for (c = getchar(); c <= 32; c = getchar())
;
if (c == '-') fu = 1, c = getchar();
for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';... |
#include <bits/stdc++.h>
using namespace std;
template <class t>
ostream &operator<<(ostream &tout, const vector<t> &s) {
tout << '[';
for (int i = 0; i < s.size(); i++)
if (i + 1 == s.size())
tout << s[i];
else
tout << s[i] << ',';
tout << ']';
return (tout);
}
template <class a, class b>
o... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T min(T &a, T &b) {
return a < b ? a : b;
}
template <class T>
inline T max(T &a, T &b) {
return a > b ? a : b;
}
template <class T>
void read(T &x) {
char ch;
while ((ch = getchar()) && !isdigit(ch))
;
x = ch - '0';
while ((ch = ge... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 100;
const int inf = 0x3f3f3f3f;
const int iinf = 1 << 30;
const long long linf = 2e18;
const long long mod = 998244353;
const double eps = 1e-7;
template <class T = int>
T read() {
T f = 1, a = 0;
char ch = getchar();
while (!isdigit(ch)) {
... |
#include <bits/stdc++.h>
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
using namespace std;
int stk[3010], n, top = 0;
long double ans = 0;
bool in[3010], loop[3010], found = false;
vector<int> nxt[3010];
vector<pair<int, int> > vec[3010];
template <class T>
void read... |
#include <bits/stdc++.h>
using namespace std;
int n;
struct edge {
int v;
int next;
edge() {}
edge(int v, int next) : v(v), next(next) {}
} e[6004];
int ind[3004];
bool vzt[3004];
int stk[3004];
int top, newedge;
int circle_len;
bool oncircle[3004];
int d[3];
int path_on_circle;
double ans;
void addedge(int u, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.