Page 122 - C:\Users\Admin\Desktop\Sach mem upweb\
P. 122
100 Problems & Solutions Trang 122
uses crt;
const max =100;
fi ='bai67.inp';
fo ='bai67.out';
var a :array[1..max,1..max]of longint;
m,n :integer;
procedure docf;
var f :text;
i,j :integer;
begin
assign(f,fi);
reset(f);
read(f,m,n);
for i:=1 to m do
for j:=1 to n do read(f,a[i,j]);
close(f);
end;
procedure lam;
var f :text;
i,j,ma,mi,k :longint;
begin
assign(f,fo);
rewrite(f);
for j:=1 to n do
begin
ma:=0;mi:=maxlongint;
for i:=1 to m do
begin
if a[i,j]>ma then ma:=a[i,j];
if a[i,j]<mi then mi:=a[i,j];
end;
if (ma>0)and(mi=0) then
begin
rewrite(f);
writeln(f,'No solution');
break;
end;
repeat
for i:=1 to m do
begin
while a[i,j]*2<=ma do
begin
for k:=1 to n do a[i,k]:=a[i,k]*2;
writeln(f,'nhan 2 dong :',i);
end;
a[i,j]:=a[i,j]-1;
end;
dec(ma);
Tin học & Nhà trường 100 Đề Toán - Tin học