Äàíà êâàäðàòíàÿ ìàòðèöà ïîðÿäêà M. Ïîâåðíóòü åå íà óãîë 90° ïî ÷àñîâîé ñòðåëêå. Âñïîìîãàòåëüíóþ ìàòðèöó íå èñïîëüçîâàòü.
Uses CRT;
Const Max = 7;
Var M : Array [1..Max, 1..Max]
Of Byte;
I, J : Word;
Procedure Rotate(S:Word);
Var I,J,L : Word;
T : Byte;
Begin
L := Round(S/2);
For I := 0 To L-1
Do
For J := 0 To L-1
Do
Begin
T
:= M[I+1, J+1];
M[I+1, J+1] := M[Max-J, I+1];
M[Max-J, I+1] := M[Max-I, Max-J];
M[Max-I, Max-J] := M[J+1, Max-I];
M[J+1, Max-I] := T;
End;
End;
Begin
ClrScr;
Randomize;
For I := 1 To Max
Do
For J := 1 To
Max Do
M[I,J] :=
Random(100);
For I := 1 To Max
Do
Begin
For J :=
1 To Max Do
Write(M[I,J]:3);
WriteLn;
End;
Rotate(Max);
WriteLn;