fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. unsigned short n, r, c;
  6. cin >> n;
  7. int ** x = new int * [n];
  8. for (int i = 0; i < n; i++)
  9. x[i] = new int[n];
  10. for (int i = 0; i < n; i++)
  11. for (int j = 0; j < n; j++)
  12. cin >> x[i][j];
  13. cin >> r >> c;
  14. for (int i = 0; i < r; i++) {
  15. for (int j = 0; j < c; j++)
  16. cout << x[i][j] << " ";
  17. cout << endl;
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 15240KB
stdin
6
30 -10 30 -69 -84 75
-3 -39 60 15 75 -74
36 68 35 23 25 -44
16 42 83 15 59 -18
71 43 35 -81 -38 51
37 -49 55 26 6 33
4 5
stdout
30 -10 30 -69 -84 
-3 -39 60 15 75 
36 68 35 23 25 
16 42 83 15 59