Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project5;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils;
- const
- M = 5;
- N = 5;
- type
- TMatrix = array[1..M] of array[1..N] of Integer;
- var
- i, j: Integer;
- F: Text;
- A: TMatrix;
- function CheckStr(const A: TMatrix; x: Integer): Boolean;
- var
- y: Integer;
- oddNum: Boolean;
- begin
- oddNum := False;
- y := 1;
- while (y <= N) and (not oddNum) do
- begin
- if Odd(A[x, y]) then
- oddNum := True;
- Inc(y);
- end;
- CheckStr := not oddNum;
- end;
- function GetLastStr(const A: TMatrix): Integer;
- var
- k, strNum: Integer;
- begin
- strNum := 0;
- for k := 1 to M do
- if CheckStr(A, k) then
- strNum := k;
- GetLastStr := strNum;
- end;
- begin
- AssignFile(F, 'input.txt');
- Reset(F);
- for i := 1 to M do
- for j := 1 to N do
- Readln(F, A[i, j]);
- CloseFile(F);
- Write(GetLastStr(A));
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement