拯救海文星
一开始写了二分,发现可能爆double,猜到次数高了以后-1附近比较安全,就写了个牛顿迭代,其实开extended,二分也可以A的说。
CodeCONST FileName=''; delta=0.000001; oo=1E308;var a:array[0..10000] of longint; b:array[0..10000] of int64; n,i:longint; x1,x2:double;function f(x:double):double; var i:longint; temp:double; begin f:=a[0];temp:=x; for i:=1 to n do begin f:=f+a[i]*temp; temp:=temp*x*x; end; end;function g(x:double):double; var i:longint; temp:double; begin g:=b[1];temp:=x*x; for i:=2 to n do begin g:=g+b[i]*temp; temp:=temp*x*x; end; end;BEGINreadln(n);for i:=0 to n do read(a[i]);for i:=1 to n do b[i]:=a[i]*(i<<1-1);if n=0 then writeln(0) else begin write('1 '); x1:=-1;x2:=-1; repeat x1:=x2; x2:=x1-f(x1)/g(x1); until abs(x1-x2)