4 solutions
-
-3
#include<bits/stdc++.h> using namespace std; int main(){ double a,b,c,x1,x2,n; cin>>a>>b>>c; n=b*b-4*a*c; if(n>=0) { x1=(-b+sqrt(n))/(2*a); x2=(-b-sqrt(n))/(2*a); if(x1==x2) { cout<<fixed<<setprecision(5)<<"x1=x2="<<x1; } else if(x1<x2) { cout<<fixed<<setprecision(5)<<"x1="<<x1<<";x2="<<x2; } else { cout<<fixed<<setprecision(5)<<"x1="<<x2<<";x2="<<x1; } } else { cout<<"No answer!"; } return 0; }
Information
- ID
- 865
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 125
- Accepted
- 31
- Uploaded By