{ float a,b,c,x1,x2,temp; scanf("%f%f%f",&a,&b,&c); x1=(-b+sqrt(b*b-4*a*c))/(2*a);//大根 x2=(-b-sqrt(b*b-4*a*c))/(2*a);//小根 if(x1<x2)//交换两根位置 { temp=x1; x1=x2; x2=temp; } printf("%.2f %.2f\n",x1,x2); return 0; }...
算法提高 Quadratic Equation 时间限制:1.0s 内存限制:512.0MB 时间限制:1.0s 内存限制:512.0MB 问题描述 求解方程ax2+bx+c=0的根。要求a, b, c由用户输入,并且可以为任意实数。 输入格式:输入只有一行,包括三个系数,之间用空格格开。 输出格式
double a,b,c,x1,x2; char x; cout<<"enter the value of a="; cin>>a; cout<<"enter the value of b="; cin>>b; cout<<"enter the value of c="; cin>>c; cout<<"the quadratic equation is"<<a; cout<<"*x*x+"<<b; ...
Quadratic Equation Mar 13, 2017 at 3:19pm Tomheza(70) So this is an exercise for a C++ class and i got a task: How many real different solutions does an equation: ax2+bx+c = 0 has. Input is: -10^6<=a,b,c>=10^6 it means a,b and c can be 0....
public class QuadraticEquation { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double a = scanner.nextDouble(); double b = scanner.nextDouble(); double c = scanner.nextDouble(); double discriminant = Math.pow(b, 2) - 4 * a * c; System.out.print...
Breadcrumbs noi.openjudge.cn /src /1 /4 / quadratic_equation.cppTop File metadata and controls Code Blame 78 lines (61 loc) · 1.54 KB Raw #include <iostream> #include <iomanip> #include <cmath> #define ERRORS 0.00001 /* quadratic equation */ /* ax^2 + bx + c = 0 */ double ...
Quadratic equation(二次剩余,板子) 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Amy asks Mr. B problem B. Please help Mr. B to solve the following problem. Let p = 1000000007....
hdu 2394 Johnny and the Quadratic Equation http://acm.hdu.edu.cn/showproblem.php?pid=2394 题目的大概意思就是,判断关于x的二次同余方程 a x^2 + b x + c = 0 ( mod 2 ^32 ) 是否有解 看到这道题目的时候刚好看了一些二次互反律之类的知识,思维被定向到了那边,又在网上找了一些资料,但是都...
c = int(input('Enter c:')) # If a is 0, then incorrect equation if a == 0: print("Input correct quadratic equation") else: findRoots(a, b, c) Explanation - In the above code, we have imported the math module and defined the formula to calculate discriminant. We have then defin...
to solve quadratic equation ok 31st May 2018, 6:41 PM Moha Äwèl 1 AnswerAnswer + 1 just use the quadratic formula 31st May 2018, 7:08 PM MaxAnswer Often have questions like this? Learn more efficiently, for free: Introduction to Python 7.1M learners Introduction to Java 4.7M learners...