记录编号 32592 评测结果 AAAAAAAAAA
题目名称 网球赛 最终得分 100
用户昵称 Gravatarlizhe 是否通过 通过
代码语言 Pascal 运行时间 0.436 s
提交时间 2011-11-07 14:18:19 内存使用 8.20 MiB
显示代码纯文本
program elimination;
var
  i,j,k,n,num,maxn:longint;
  max:real;
  f:array[0..10,1..1024]of real;
  a:array[1..1024,1..1024]of real;
procedure init;
begin
  assign(input,'elimination.in');
  reset(input);
  assign(output,'elimination.out');
  rewrite(output);
  read(n);
  num:=1;
  for i:=1 to n do
    num:=num*2;
  for i:=1 to num do
    for j:=1 to num do
    begin
	    read(a[i,j]);
	    a[i,j]:=a[i,j]/100
    end;
  for i:=1 to num do
    f[0,i]:=1
end;

procedure get(l,r,x:longint);
var
  i,j,k,mid:longint;
begin
  if x=1 then
  begin
    f[x,l]:=a[l,r];
    f[x,r]:=a[r,l];
    exit
  end;
  mid:=(l+r)shr 1;
  get(l,mid,x-1);
  get(mid+1,r,x-1);
  for i:=l to mid do
    for j:=mid +1 to r do
      f[x,i]:=f[x,i]+f[x-1,i]*f[x-1,j]*a[i,j];
  for i:=mid+1 to r do
    for j:=l to mid do
      f[x,i]:=f[x,i]+f[x-1,i]*f[x-1,j]*a[i,j]
end;

procedure print;
begin
  for i:=1 to num do
    if max<f[n,i] then
    begin
	    max:=f[n,i];
	    maxn:=i
    end;
  writeln(maxn);
  close(input);
  close(output)
end;

begin
  init;
  get(1,num,n);
  print
end.