[r]
(1)Bài 30/2000 - Phần tử yên ngựa
(Dành cho học sinh THCS) const
Inp = 'Bai30.INP'; Out = 'Bai30.OUT';
MaxLongInt = 2147483647; var
Min, Max: array[1 5000] of LongInt; m, n: Integer;
procedure ReadInput; var
i, j, k: Integer; hf: Text; begin
Assign(hf, Inp); Reset(hf);
Readln(hf, m, n);
for i := to m Min[i] := MaxLongInt; for j := to n Max[j] := -MaxLongInt; for i := to m
begin
for j := to n begin
Read(hf, k);
if Min[i] > k then Min[i] := k; if Max[j] < k then Max[j] := k; end;
Readln(hf); end;
Close(hf); end;
procedure WriteOutput; var
i, j: Integer; Result: Boolean; hf: Text;
begin
Result := False; Assign(hf, Out); Rewrite(hf);
Writeln(hf, 'Cac phan tu yen ngua la: '); for i := to m
for j := to n
if Min[i] = Max[j] then begin
(2)Write(hf, '(', i, ',', j, '); '); end;
if not Result then begin
Rewrite(hf);
Write(hf, 'Khong co phan tu yen ngua'); end;
Close(hf); end;
begin ReadInput; WriteOutput; end