比赛 20091110 评测结果 WEWWWWWEEE
题目名称 股票收益 最终得分 0
用户昵称 麦、洛洛 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-10 11:57:38
显示代码纯文本
program gp;
var
        d:array[1..1000,1..1000] of real;
        a:array[1..1000] of real;
        i,j,k,l,m,n:integer;
        f:text;
        g,max,o:real;
begin
        assign(f,'stock.in');
        reset(f);
        readln(f,n);
        for i:=1 to n do
        read(f,a[i]);
        readln(f);
        readln(f,m);
        close(f);
        max:=0;
        for i:=1 to n do
        d[i,i]:=a[i];
        for i:=n downto 1 do
        for j:=1 to n do
                if j>i then
                begin
                        o:=d[i+1,j]-d[i,j-1];
                        d[i,j]:=m/d[i,j-1]*o;
                end;
        for i:=1 to n do
        for j:=1 to n do
        begin
                if j>i then
                begin
                        if d[i,j]<0 then
                        k:=k+1;
                        if d[i,j]>max then
                        max:=d[i,j];
                end;
        end;
        g:=k/((n*n-n)/2);
        assign(f,'stock.out');
        rewrite(f);
        writeln(f,max:0:3);
        writeln(f,g:0:3);
        close(f);
end.