Advertisement
Semior001

Abramyan matrix36

Sep 13th, 2016
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.65 KB | None | 0 0
  1. uses crt;
  2. const
  3.     n = 10;
  4.     m = 10;
  5. type
  6.     vector = array[1..m] of integer;
  7.     matrix = array[1..n] of vector;
  8. var
  9.     a: matrix;
  10.     f: text;
  11.     count, i, j: integer;
  12.     firstLine, ourLine: set of integer;
  13. begin
  14.     clrscr;
  15.  
  16.     assign(f, 'matrix36.in');
  17.     reset(f);
  18.     for i:=1 to n do
  19.         for j:=1 to m do
  20.             read(f, a[i][j]);
  21.     close(f);
  22.  
  23.     firstLine:= [];
  24.     for j:=1 to m do
  25.         firstLine := firstLine + [a[i][j]];
  26.  
  27.     count:=0;
  28.     for i:=2 to n do
  29.     begin
  30.         ourLine:= [];
  31.         for j:=1 to m do
  32.             ourLine:=ourLine + [a[i][j]];
  33.         if firstLine = ourLine then
  34.             count:=count+1;
  35.     end;
  36.  
  37.     assign(f, 'matrix36.out');
  38.     rewrite(f);
  39.     writeln(f, count);
  40.     close(f);
  41.  
  42. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement