1 条题解

  • 0
    @ 2025-4-14 18:45:30

    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

    信息

    ID
    3458
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者