比赛 20111104 评测结果 AAAAAAAAAA
题目名称 网球赛 最终得分 100
用户昵称 Des. 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-11-04 21:40:04
显示代码纯文本
program elimination;
var p:array[1..2000,1..2000]of real;
    f:array[1..11,1..2000]of real;
    t,k,m,n,i,j,x,y,z:longint;
    s:real;
begin
assign(input,'elimination.in');
reset(input);
assign(output,'elimination.out');
rewrite(output);
readln(n);
m:=1 shl n;
for t:=1 to m do
  begin
    for k:=1 to m do
      begin
        read(p[t,k]);
        p[t,k]:=p[t,k]/100;
      end;
    readln;
  end;
for i:=1 to m do
  if odd(i) then f[1,i]:=p[i,i+1]
  else f[1,i]:=p[i,i-1];
for i:=2 to n do
  for j:=1 to m do
    begin
      z:=j;
      t:=0;
      repeat
        z:=(z+1)div 2;
        inc(t);
      until t=i-1;

      if z and 1=1 then
        begin
          x:=(z)*(1 shl (i-1))+1;
          y:=(z+1)*(1 shl (i-1));
        end
      else
        begin
          y:=(z-1)*(1 shl (i-1));
          x:=(z-2)*(1 shl (i-1))+1;
        end;
      t:=0;
      s:=0;
      for k:=x to y do
        s:=s+p[j,k]*f[i-1,k];
      f[i,j]:=f[i-1,j]*s;
    end;
i:=0;
s:=0;
for t:=1 to m do
  begin
    if f[n,t]>s then
      begin
        s:=f[n,t];
        i:=t;
      end;
  end;
writeln(i);
close(output);
end.