1 solutions

  • 0
    @ 2025-11-5 15:29:10

    C++ :

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<string>
    #include<cstdlib>
    #include<cmath>
    #include<iomanip>
    #include<algorithm>
    using namespace std;
    double a,b,c,d;
    int k=0;
    int main(){
    	scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
    	//cin>>a>>b>>c>>d;
    	double x,temp;
    	for(x=-100*1.0;x<=1.0*100;x=1.0*0.01+1.0*x){
    		temp=1.0*(a*x*x*x+b*x*x+c*x+d);
    		if(temp==0.0||(temp>=-0.001&&temp<=0.001)) {
    			k++;
    			printf("%.2f",x);
    			if(k!=3) cout<<" ";
    			else break;
    		}
    	}
    	
    	return 0;
    }
    
    • 1

    Information

    ID
    16847
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By