197 条题解

  • 0
    @ 2009-10-29 08:18:52

    liuking_K 同学说的有道理,但题目中已说明“根与根的绝对值之差>=1”,所以可以用f[x1]*f[x2]

  • 0
    @ 2009-10-24 07:03:30

    var

    a,b,c,d,xx,x1,x2:real;

    x:longint;

    function f(x:extended):extended;

    begin

    f:=x*x*x+b*x*x+c*x+d;

    end;

    begin

    read(a,b,c,d);

    b:=b/a;c:=c/a;d:=d/a;a:=1;

    for x:=-100 to 100 do

    begin

    x1:=x;x2:=x+1;

    if f(x1)=0 then write(x1:0:2,' ')

          else if (f(x1)*f(x2)=0.001 do

                         begin

                         xx:=(x2+x1)/2;

                         if f(x1)*f(xx)

  • 0
    @ 2009-10-12 18:49:13

    WA了一次;

    后来加了一个精度判断:

    if abs(f(l)*f(r)-0)

  • 0
    @ 2009-10-11 10:36:39

    这个是一元三次方程。

    if(f[x1]*f[x2]>0) 并不代表 [x1,x2]间无解

  • 0
    @ 2009-10-07 21:27:22

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    var

    a,b,c,d,xx,x1,x2:real;

    x:longint;

    function f(x:extended):extended;

    begin

    f:=x*x*x+b*x*x+c*x+d;

    end;

    begin

    read(a,b,c,d);

    b:=b/a;c:=c/a;d:=d/a;a:=1;

    for x:=-100 to 100 do

    begin

    x1:=x;x2:=x+1;

    if f(x1)=0 then write(x1:0:2,' ')

    else if (f(x1)*f(x2)=0.001 do

    begin

    xx:=(x2+x1)/2;

    if f(x1)*f(xx)

  • 0
    @ 2009-10-07 14:18:03

    贴一下数据:

    1) 1 -2 -1 2 输出 -1.00 1.00 2.00

    2) 1 -4.65 2.25 1.4 输出-0.35 1.00 4.00

    3) 1 10 -1 -10 输出 -10.00 -1.00 1.00

    4)1 -1.8 -8.59 -0.84 输出-2.10 -0.10 4.00

  • 0
    @ 2009-09-18 19:03:47

    一开始用递归做...1个数据爆栈

    重写

  • 0
    @ 2009-09-18 18:27:50

    可读性比较强的题解和程序

    比较适合新手

    http://wwzhwdwd.blog.163.com/blog/static/128151450200981862517788

  • 0
    @ 2009-09-05 18:26:09

    var

    x,a,b,c,d:real;

    i,s:longint;

    function f(x:real):real;

    begin

    f:=a*x*x*x+b*x*x+c*x+d;

    end;

    begin

    readln(a,b,c,d);

    s:=0;

    for i:=-10000 to 10000 do

    begin

    x:=i/100;

    if (f(x)>-0.0001) and (f(x)3 then exit;

    end;

    end;

    end.

  • 0
    @ 2009-09-01 20:07:21

    求导 f(x)'=3ax^2+2bx+c

    对[-100,x1),(x1,x2),(x2,100]二分(x1

  • 0
    @ 2009-08-27 11:35:08

    水题

    如上

  • 0
    @ 2009-08-19 22:21:21

    sorry 啦,我不会求啊,用枚举、分治、还是搜索都超时啊,所以借鉴一下,有点罪恶感……

  • 0
    @ 2009-08-12 17:25:15

    var i,j:longint;

    a,b,c,d,l,r,mid:real;

    function f(x:real):real;

    begin

    exit(((a*x+b)*x+c)*x+d);

    end;

    begin

    assign(input,'equation.in');reset(input);

    assign(output,'equation.out');rewrite(output);

    readln(a,b,c,d);

    for i:=-100 to 100 do

    begin

    l:=i;r:=i+1;

    if f(l)=0 then write(l:0:2,' ')

    else if f(l)*f(r)=0.005 do

    begin

    mid:=(l+r)/2;

    if f(l)*f(mid)

  • 0
    @ 2009-08-10 10:43:21

    看看把,多简单就过了…………

    #include

    #include

    using namespace std;

    double a,b,c,d;int j=0;

    double s[4];

    double f(double x){

    return a*x*x*x+b*x*x+c*x+d;

    }

    void print(){

    cout

  • 0
    @ 2009-08-06 23:04:41

    悲剧升级中。。

    又抄别人的

  • 0
    @ 2009-08-04 21:14:58

    C++版

    #include

    #include

    using namespace std;

    float x[4],a,b,c,d,u,v;

    int i,t=0;

    float f(float x){

    return (((a*x+b)*x+c)*x+d);

    }

    int main (){

    scanf ("%f%f%f%f",&a,&b,&c,&d);

    for (i=-100;i

  • 0
    @ 2009-08-02 14:37:15

    1、枚举;

    2、分治。

  • 0
    @ 2009-07-30 21:38:26

    program li;

    var i,j:longint;

    a,b,c,d,l,r,mid:real;

    function f(x:real):real;

    begin

    exit(((a*x+b)*x+c)*x+d);

    end;

    begin

    readln(a,b,c,d);

    for i:=-100 to 100 do

    begin

    l:=i; r:=i+1;

    if f(l)=0 then write(l:0:2,' ')

    else if f(l)*f(r)=0.005 do

    begin

    mid:=(l+r)/2;

    if f(l)*f(mid)

  • 0
    @ 2009-07-29 19:30:28

    世界上最可怜的人————————只会用c————————不会用FP!!!!!

  • 0
    @ 2009-07-25 19:44:05

    是啊是啊

    枚举AC

    直接打提交框

信息

ID
1116
难度
5
分类
搜索 | 枚举 点击显示
标签
递交数
7786
已通过
2832
通过率
36%
被复制
14
上传者