Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project3;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils;
- type
- TMatrix = Array of Array of Integer;
- procedure FillMatrix(var Matrix: TMatrix; var Size: Integer);
- var
- FirstRow: Array of Integer;
- i, j, k, Count: Integer;
- IsConcident: Boolean;
- begin
- Write('Enter the size: ');
- ReadLn(Size);
- SetLength(Matrix, Size, Size);
- Size := Size - 1;
- WriteLn('Fill the Matrix');
- for i := 0 to Size do
- for j := 0 to Size do
- begin
- Write('А[', i, ', ', j, '] = ');
- ReadLn(Matrix[i, j]);
- end;
- end;
- procedure CountMatches(Matrix: TMatrix; Size: Integer; var Count: Integer);
- var
- Matches: Boolean;
- i,j,k: Integer;
- FirstRow: Array of Integer;
- begin
- SetLength(FirstRow, Size);
- for i := 0 to Size do
- FirstRow[i] := Matrix[0, i];
- for i := 0 to Size do
- begin
- Matches := True;
- for j := 0 to Size do
- for k := 0 to Size do
- if Matrix[i, j] = FirstRow[k] then
- Matches := False;
- if Matches then
- Inc(Count);
- end;
- end;
- procedure Output(Count: Integer);
- begin
- Writeln('Number of rows without matches', Count);
- end;
- procedure Main();
- var
- Matrix: TMatrix;
- Count, Size: Integer;
- begin
- FillMatrix(Matrix, Size);
- CountMatches(Matrix, Size, Count);
- Output(Count);
- Readln;
- Readln;
- end;
- begin
- Main();
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement