# include <bits/stdc++.h>
using namespace std;

int main ()
{
	double a,b,c;
	cin>>a>>b>>c;
	if(sqrt(b*b-4*a*c)>0)
	{if((-b+sqrt(b*b-4*a*c))/(2*a)<(-b-sqrt(b*b-4*a*c))/(2*a))
	
	printf("x1=%.5lf;x2=%.5lf",(-b+sqrt(b*b-4*a*c))/(2*a),(-b-sqrt(b*b-4*a*c))/(2*a));}
	if(sqrt(b*b-4*a*c)<0)
	cout<<"No answer!";
	if(sqrt(b*b-4*a*c)==0)
	printf("x1=x2=%.5lf",(-b+sqrt(b*b-4*a*c))/(2*a));
	
	
	


	
	
	
	return 0; 
}

7 comments

  • @ 2024-1-28 15:42:02

    @UID:2 sfasfasdfads

    • @ 2024-1-28 15:39:14

      @2 dfasdf

      • @ 2024-1-28 15:38:48

        @34 fdsv

        • @ 2024-1-28 15:36:50

          @47 的撒

          • @ 2024-1-28 15:36:09

            @34 的撒旦

            • @ 2024-1-28 15:31:01

              d

              • @ 2023-11-5 11:52:21

                1.判别式(Δ\Delta)是 b24acb^2-4ac 不能带根号。根号下不能是负数。
                2.Δ=0\Delta = 0时输出b2a\frac{-b}{2a}就行了。

                # include <bits/stdc++.h>
                using namespace std;
                
                int main ()
                {
                	double a,b,c;
                	cin>>a>>b>>c;
                	if(b*b-4*a*c>0)
                        if((-b+sqrt(b*b-4*a*c))/(2*a) > (-b-sqrt(b*b-4*a*c))/(2*a))
                	        printf("x1=%.5lf;x2=%.5lf",(-b-sqrt(b*b-4*a*c))/(2*a),(-b+sqrt(b*b-4*a*c))/(2*a));
                        else printf("x1=%.5lf;x2=%.5lf",(-b+sqrt(b*b-4*a*c))/(2*a),(-b-sqrt(b*b-4*a*c))/(2*a));
                	if(b*b-4*a*c<0)
                	    cout<<"No answer!";
                	if(b*b-4*a*c == 0)
                	    printf("x1=x2=%.5lf",(-b)/(2*a));
                	return 0; 
                }
                
                • 1