Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses crt;
- const
- n = 10;
- m = 10;
- type
- vector = array[1..m] of integer;
- matrix = array[1..n] of vector;
- var
- a: matrix;
- f: text;
- count, i, j: integer;
- lastColumn, ourColumn: set of integer;
- begin
- clrscr;
- assign(f, 'matrix37.in');
- reset(f);
- for i:=1 to n do
- for j:=1 to m do
- read(f, a[i][j]);
- close(f);
- count:=0;
- lastColumn:=[];
- for i:=1 to n do
- lastColumn := lastColumn + [a[i][m]];
- for j:=1 to m-1 do
- begin
- ourColumn:=[];
- for i:=1 to n do
- ourColumn:= ourColumn + [a[i][j]];
- if lastColumn = ourColumn then
- count:=count+1;
- end;
- assign(f, 'matrix37.out');
- rewrite(f);
- writeln(f, count);
- close(f);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement