记录编号 32723 评测结果 AAAAAAAAAA
题目名称 网球赛 最终得分 100
用户昵称 GravatarLauncher 是否通过 通过
代码语言 Pascal 运行时间 0.450 s
提交时间 2011-11-07 21:14:57 内存使用 16.15 MiB
显示代码纯文本
program elimination;
var
 p,a:array[1..1025,1..1025]of real;
 max:real;
 i,j,k,m,n,len,t,x,y:longint;

begin
 assign(input,'elimination.in');reset(input);assign(output,'elimination.out');rewrite(output);
 readln(m);
 n:=1;
 for i:=1 to m do
  n:=n*2;
 for i:=1 to n do
  for j:=1 to n do
   begin
    read(a[i,j]);
    a[i,j]:=a[i,j]/100;
   end;
 fillchar(p,sizeof(p),0);
 for i:=1 to n do
  if i mod 2=1 then p[i,1]:=a[i,i+1] else p[i,1]:=a[i,i-1];
 for i:=2 to m do
  begin
    k:=1;
    for j:=1 to i-1 do
      k:=k*2;
    for j:=1 to n do
     begin
      len:=((j-1) div k)+1;
      if len mod 2=1 then
       for t:=k*len+1 to k*len+k do
         p[j,i]:=p[j,i]+p[j,i-1]*p[t,i-1]*a[j,t];
      if len mod 2=0 then
       for t:=k*len-k*2+1 to k*len-k do
         p[j,i]:=p[j,i]+p[j,i-1]*p[t,i-1]*a[j,t];

     end;
  end;

 max:=0;j:=0;
 for i:=1 to n do
  if p[i,m]>max then
   begin
     max:=p[i,m];
     j:=i;
   end;
 writeln(j);
 close(input);close(output);
end.