ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#206393 | #1745. 一元三次方程求解 | Allen123456hello | 100 | 1ms | 1244kb | C++11 | 370b | 2024-07-22 17:49:12 | 2024-07-22 20:01:49 |
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
long double a,b,c,d;
long double f(long double x){
return a*x*x*x+b*x*x+c*x+d;
}
int main(){
scanf("%Lf%Lf%Lf%Lf",&a,&b,&c,&d);
int cnt=0;
for (long double j=-100;j<=100;j+=0.01){
if (abs(f(j))<1.0e-5L){printf("%.2Lf%c",j," \n"[(++cnt)==3]);}
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 25
Accepted
time: 0ms
memory: 1232kb
input:
1 -2 -1 2
output:
-1.00 1.00 2.00
result:
ok single line: '-1.00 1.00 2.00'
Test #2:
score: 25
Accepted
time: 0ms
memory: 1240kb
input:
1 -4.65 2.25 1.4
output:
-0.35 1.00 4.00
result:
ok single line: '-0.35 1.00 4.00'
Test #3:
score: 25
Accepted
time: 1ms
memory: 1236kb
input:
1 10 -1 -10
output:
-10.00 -1.00 1.00
result:
ok single line: '-10.00 -1.00 1.00'
Test #4:
score: 25
Accepted
time: 0ms
memory: 1244kb
input:
1 -1.8 -8.59 -0.84
output:
-2.10 -0.10 4.00
result:
ok single line: '-2.10 -0.10 4.00'