5 条题解

  • 2
    @ 2024-10-1 14:53:23
    #include<bits/stdc++.h>
    using namespace std;
    
    int main(){
    	int a,b,c,h;
    	cin>>a>>b>>c;
    	h=b*b-4*a*c;
    	if (h<0) { cout<<"error";}
    	else{
    	if (h==0) {cout<<fixed<<setprecision(3)<<(-1*b*1.0/(2*a));}
    	else{
    		cout<<fixed<<setprecision(3)<<((-1*b-sqrt(h))*1.0/(2*a))<<" "<<((-1*b+sqrt(h))*1.0/(2*a));
    	}
    	}
    	return 0;
    }
    

    信息

    ID
    47
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    递交数
    72
    已通过
    32
    上传者