9 条题解
-
0
#include<bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; int const N=1e5+10; double a,b,c; int main(){ cin>>a>>b>>c; double x1=(-b+sqrt(b*b-4*a*c))/(2*a),x2=(-b+-sqrt(b*b-4*a*c))/(2*a); if(a==0){ cout<<"No answer!"; return 0; }else if(b*b-4*a*c<0){ cout<<"No answer!"; return 0; } else if(x1==x2){ cout<<"x1=x2="<<fixed<<setprecision(5)<<x1; }else if(x1<x2){ cout<<"x1="<<fixed<<setprecision(5)<<x1<<";x2="<<fixed<<setprecision(5)<<x2; }else if(x1>x2){ cout<<"x1="<<fixed<<setprecision(5)<<x2<<";x2="<<fixed<<setprecision(5)<<x1; } return 0; }
信息
- ID
- 876
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 605
- 已通过
- 158
- 上传者