Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
31209 | 徐若宸 | 一元三次方程求解 | C++ | Wrong Answer | 2 MS | 252 KB | 303 | 2023-11-17 21:22:58 |
#include <bits/stdc++.h> using namespace std; double a,b,c,d; const double dx=0.001; double f(double x){ return a*x*x*x+b*x*x+c*x+d; } int main(){ cin>>a>>b>>c>>d; double l=-200,r=+200; for(double i=l;i<=r;i+=dx){ if(f(i)*f(i+dx)<=0){ printf("%.2f",i); } } return 0; }