记录编号 32689 评测结果 AAAAAAAAAA
题目名称 网球赛 最终得分 100
用户昵称 Gravatarfeng 是否通过 通过
代码语言 Pascal 运行时间 0.522 s
提交时间 2011-11-07 18:38:52 内存使用 16.15 MiB
显示代码纯文本
program lx;
const
  filename='elimination';
  inf=filename+'.in';
  ouf=filename+'.out';
  maxn=1024;
var
  i,j,k,l,m,n,x,p,y:longint;
  sum:real;
  a,f:array[0..maxn,0..maxn]of real;
function xy(x:longint):longint;
  var i,j:longint;
    begin
      j:=1;
      for i:=1 to x do
        j:=j*2;
      xy:=j;
    end;
begin
  assign(input,inf); reset(input);
  assign(output,ouf);rewrite(output);
  readln(m);
  fillchar(f,sizeof(f),0);
  fillchar(a,sizeof(a),0);
  n:=1;
  for i:=1 to m do
    n:=2*n;
  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;
  for i:=1 to n do
    f[0,i]:=1;
  for i:=1 to m do
    for j:=1 to n do
      begin
        x:=xy(i-1);
        p:=(j-1)div x;
        if p mod 2=0 then
        y:=x
         else y:=-x;
        for k:=(p*x+y+1) to (p*x+y+x)  do
        f[i,j]:=f[i-1,j]*f[i-1,k]*a[j,k]+f[i,j];
      end;
      sum:=0;
  for i:=1 to n do
    if f[m,i]>sum then begin
                         sum:=f[m,i];
                         j:=i;
                       end;

   writeln(j);


  close(input);close(output);
end.