Advertisement
Josif_tepe

Untitled

Mar 9th, 2025
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. using namespace std;
  5. typedef long long ll;
  6.  
  7.  
  8. int main() {
  9.     int n, m;
  10.     cin >> n >> m;
  11.    
  12.     int mat[n][m];
  13.     int idx = 0;
  14.    
  15.     for(int i = 0; i < n; i++) {
  16.         for(int j = 0; j < m; j++) {
  17.             mat[i][j] = idx;
  18.             idx++;
  19.         }
  20.     }
  21.    
  22.     for(int i = 0; i < n; i++) {
  23.         for(int j =0 ; j < m; j++) {
  24.             cout << mat[i][j] << " ";
  25.         }
  26.         cout << endl;
  27.     }
  28.    
  29.    
  30.     return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement