🟡 Վարժություն 18

Գրել ծրագիր, որն էկրանին տպում է մուտքագրված մատրիցը սպիռալաձև։
notion image
Օրինակ՝
Մուտք՝ 
1  2  3  4
5  6  7  8 
9 10 11 12
12 14 15 16
Ելք՝
1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
 
#include <iostream>

int main() {
  constexpr int rowsCount = 4, columnsCount = 4;
  int matrix[rowsCount][columnsCount];
  // Put your code to insert matrix elements
  // Put your code to print matrix in spiral form 
}

Constraints

Time limit: 0.2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue