有N个选手,n等于2的m次幂每天比赛一场,比n-1天。
程序如下:
const
maxn=1000;var
i,j,m:longint;
n,k,s:qword;
a:array[0..maxn,0..maxn]of qword;
begin
readln(m);
n:=1;
s:=1;
for i:=1 to m do
n:=n*2;
k:=1;
a[1,1]:=1;
while k<=m do
begin
for i:=1 to s do
for j:=1 to s do
a[i,j+s]:=a[i,j]+s;
for i:=1 to s do
for j:=1 to s do
begin
a[i+s,j]:=a[i,j+s];
a[i+s,j+s]:=a[i,j];
end;
s:=s*2; k:=k+1;
end;
for i:=1 to n do
begin
for j:=1 to n do
writeln(a[i,j]:4);
writeln;
end;
end.