Advertisement
STANAANDREY

bacT1 sIII 2

May 24th, 2021
1,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #define NMAX 23
  4. int n, k, arr[NMAX][NMAX];
  5.  
  6. int main() {
  7.     cin >> n >> k;
  8.     int col = 1;
  9.     for (int i = 1; i <= n; i++) {
  10.         for (int j = 0; j < n; j++) {
  11.             for (int kk = 0; kk < k; kk++) {
  12.                 arr[i][col] = i + j;
  13.                 col++;
  14.             }
  15.         }
  16.         col = 1;
  17.     }
  18.     for (int i = 1; i <= n; i++) {
  19.         for (int j = 1; j <= n * k; j++) {
  20.             cout << arr[i][j] << ' ';
  21.         }
  22.         cout << endl;
  23.     }
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement