Page 138 - C:\Users\Admin\Desktop\Sach mem upweb\
P. 138
100 Problems & Solutions Trang 138
begin
dem:=0;
a:=h;
fillchar(dx,sizeof(dx),0);
fillchar(lap,sizeof(lap),0);
for k:=1 to N do lap[k]:=1;
for k:=1 to N do dx[k,a[1,k]+1]:=1;
end;
procedure ghikq(w:mg);
var i,j,ds:integer;
begin
inc(dem);
writeln('****** :',dem,':******');
writeln(f,'****** :',dem,':******');
for i:=1 to N do
begin
for j:=1 to N do
begin
write(w[i,j]:2);
write(f,w[i,j]:2);
end;
writeln;writeln(f);
end;
end;
function doi(k:integer):integer;
begin
if k mod N=0 then doi:=N
else doi:=k mod N;
end;
procedure try(k:byte;w:MG);
var i,j :byte;
luu :mg1c;
ldx :mg;
ok :boolean;
begin
luu:=lap;ldx:=dx;
for i:=1 to N do
begin
lap:=luu;dx:=ldx;
for j:=1 to N do w[k,j]:=a[k,doi(i+j-1)];
ok:=true;
for j:=1 to N do
begin
inc(lap[j],1-dx[j,w[k,j]+1]);
dx[j,w[k,j]+1]:=1;
if lap[j]>4 then
Tin học & Nhà trường 100 Đề Toán - Tin học