Количество последовательностей k: n=1, k = 2^1 = 2 n=2, k = 2^3 = 4 n=3, k = 2^3 = 8 n=4, k = 2^4 = 16 n=5, k = 2^5 = 32 n=6, k = 2^6 = 64 n=7, k = 2^7 = 128 n=8, k = 2^3 = 256 Последовательности: n=1: 0, 1 n=2: 00, 01, 10, 11 n=3: 000, 001, 010, 011, 100, 101, 110, 111
alenchik19938823
17.07.2020
//PascalABC.NET (версия 3.1, сборка 1196 от 09.03.2016) function Transpose(a: array[,] of integer): array[,] of integer; //Поворот на 90гр по часовой стрелке begin var m := Length(a, 0); var n := Length(a, 1); Result := new integer[n, m]; for var i := 0 to n-1 do begin for var j := 0 to m-1 do Result[i, j] := a[m-1-j, i]; end; end;
begin var n := ReadInteger('Введите n:'); //Заполнение матрицы NxN сл. числами и вывод на экран var a :=MatrixRandom(n, n); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(a[i,j]); println; end; println;
Println('поворот влево на 90 гр'); var b := Transpose(a); b:=Transpose(b); b:=Transpose(b); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(b[i,j]); println; end; println;
Println('поворот вправо на 90гр'); b := Transpose(a); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(b[i,j]); println; end; println;
Println('поворот на 180 гр'); b := Transpose(a); b := Transpose(b); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(b[i,j]); println; end; end.
n=1, k = 2^1 = 2
n=2, k = 2^3 = 4
n=3, k = 2^3 = 8
n=4, k = 2^4 = 16
n=5, k = 2^5 = 32
n=6, k = 2^6 = 64
n=7, k = 2^7 = 128
n=8, k = 2^3 = 256
Последовательности:
n=1: 0, 1
n=2: 00, 01, 10, 11
n=3: 000, 001, 010, 011, 100, 101, 110, 111