5 solutions

  • 0
    @ 2023-10-18 10:54:33
    #include <stdio.h>
    #include <math.h>
    int main()
    {
        double a,b,c,d,x1,x2,max,min;
        scanf("%lf %lf %lf",&a,&b,&c);
        d=b*b-4*a*c;x1=(-b+sqrt(d))/(2*a);x2=(-b-sqrt(d))/(2*a);
        if(x1==x2){printf("x1=x2=%.5f",x1);}else{
        if(x1<x2){max=x2;min=x1;}else{max=x1;min=x2;};
        if(d<0){printf("No answer!");};
        if(d>0){printf("x1=%.5f;x2=%.5f",min,max);};}
        return 0;
    }
    

    Information

    ID
    6735
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    9
    Tags
    (None)
    # Submissions
    712
    Accepted
    72
    Uploaded By