SHARE
TWEET

Untitled

r4lovets Jun 24th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program Project5;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8.   System.SysUtils;
  9.  
  10. const
  11.   M = 5;
  12.   N = 5;
  13.  
  14. type
  15.   TMatrix = array[1..M] of array[1..N] of Integer;
  16.  
  17. var
  18.   i, j: Integer;
  19.   F: Text;
  20.   A: TMatrix;
  21.  
  22. function CheckStr(const A: TMatrix; x: Integer): Boolean;
  23.  
  24. var
  25.   y: Integer;
  26.   oddNum: Boolean;
  27.  
  28. begin
  29.   oddNum := False;
  30.  
  31.   y := 1;
  32.   while (y <= N) and (not oddNum) do
  33.     begin
  34.       if Odd(A[x, y]) then
  35.         oddNum := True;
  36.  
  37.       Inc(y);
  38.     end;
  39.  
  40.   CheckStr := not oddNum;
  41. end;
  42.  
  43. function GetLastStr(const A: TMatrix): Integer;
  44.  
  45. var
  46.   k, strNum: Integer;
  47.  
  48. begin
  49.   strNum := 0;
  50.  
  51.   for k := 1 to M do
  52.     if CheckStr(A, k) then
  53.       strNum := k;
  54.  
  55.   GetLastStr := strNum;
  56. end;
  57.  
  58. begin
  59.   AssignFile(F, 'input.txt');
  60.   Reset(F);
  61.  
  62.   for i := 1 to M do
  63.     for j := 1 to N do
  64.       Readln(F, A[i, j]);
  65.  
  66.   CloseFile(F);
  67.  
  68.   Write(GetLastStr(A));
  69.  
  70.   Readln;
  71. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top