12 条题解
-
1
这才叫粗暴AC(初学者专用)
#include<bits/stdc++.h> using namespace std; int main(){ double a,b,c,x1,x2; cin>>a>>b>>c; x1=(-b+sqrt(b*b-4*a*c))*10000/(2*a); x2=(-b-sqrt(b*b-4*a*c))*10000/(2*a); if(a==0||b*b-4*a*c<=0){ cout<<"No answer!"; return 0; } if(x1<x2){ cout<<"x1="; cout<<fixed<<setprecision(5)<<x1/10000; cout<<";x2="; cout<<fixed<<setprecision(5)<<x2/10000; return 0; } if(x1>x2){ cout<<"x1="; cout<<fixed<<setprecision(5)<<x2/10000; cout<<";x2="; cout<<fixed<<setprecision(5)<<x1/10000; return 0; } if(x1==x2){ cout<<"x1=x2="; cout<<fixed<<setprecision(5)<<x2/10000; return 0; } }
信息
- ID
- 876
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- 递交数
- 776
- 已通过
- 210
- 上传者