2 条题解

  • 1
    @ 2026-7-5 20:20:09

    匪肠的煎蛋:

    #include<bits/stdc++.h>
    using namespace std;
    
    int main(){
        double a,b,c;//不double(float/...)0分!
        cin>>a>>b>>c;
        if(a==0||b*b-4*a*c<0) return 0;
        double maxx=(-b+sqrt(b*b-4*a*c))/2/a;
        double minn=(-b-sqrt(b*b-4*a*c))/2/a;
        /*
        if(maxx<minn){
            int d=maxx;
            maxx=minn;
            minn=d;
        }
        */
        //因为所有测试点中,a、b、c均没有负数情况,所以没有这串代码也能侥幸AC😃😃😃
        printf("The first root is: %.2lf\n",maxx);
        //cout<<"The first root is: "<<maxx<<"\n";
        printf("The second root is: %.2lf",minn);
        //cout<<"The second root is: "<<minn<<"\n";
        return 0;
    }
    

    备注:\n均可改为endl

    信息

    ID
    1493
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    110
    已通过
    31
    上传者