Advertisement
Semior001

Abramyan matrix37

Sep 13th, 2016
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.66 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.     lastColumn, ourColumn: set of integer;
  13. begin
  14.     clrscr;
  15.     assign(f, 'matrix37.in');
  16.     reset(f);
  17.     for i:=1 to n do
  18.         for j:=1 to m do
  19.             read(f, a[i][j]);
  20.     close(f);
  21.     count:=0;
  22.     lastColumn:=[];
  23.     for i:=1 to n do
  24.         lastColumn := lastColumn + [a[i][m]];
  25.  
  26.     for j:=1 to m-1 do
  27.     begin
  28.         ourColumn:=[];
  29.         for i:=1 to n do
  30.                 ourColumn:= ourColumn + [a[i][j]];
  31.  
  32.         if lastColumn = ourColumn then
  33.             count:=count+1;
  34.     end;
  35.     assign(f, 'matrix37.out');
  36.     rewrite(f);
  37.     writeln(f, count);
  38.     close(f);
  39. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement