Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
136802 李树强 解一元三次方程 C++ 通过 100 0 MS 240 KB 433 2024-03-09 15:20:17

Tests(6/6):


#include<iostream> #include<iomanip> using namespace std; double a, b, c, d; double check(double x){ return a * x * x * x + b * x * x + c * x + d; } double my_abs(double x){ if(x < 0) return -x; return x; } int main(){ cin >> a >> b >> c >> d; for(double i = -100; i <= 100; i += 0.01){ if(my_abs(check(i)) < 0.01){ cout << fixed << setprecision(2) << i << ' '; i += 0.99; } } return 0; }


测评信息: