We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Origin: 20:求一元二次方程的根 can't get this right, my recent submitted code is:
#include <cstdio> #include <cmath> const double EPS = 1e-5; int main(int argc, char const *argv[]) { double a, b, c; scanf("%lf%lf%lf", &a, &b, &c); double d = b*b; double e = 4*a*c; if (d>e) { double f = sqrt(e-d)/(2*a); printf("x1=%.5f;x2=%.5f\n", (-b+f)/(2*a), f, (-b-f)/(2*a), f); } else if (e>d) { double f = sqrt(e-d)/(2*a); double g = -b/(2.0*a); if (g < EPS && g > -EPS) g = 0.0; printf("x1=%.5f+%.5fi;x2=%.5f-%.5fi\n", g, f, g, f); } else { printf("x1=x2=%.5f\n", -b/(2*a)); } return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Origin: 20:求一元二次方程的根
can't get this right, my recent submitted code is:
The text was updated successfully, but these errors were encountered: