fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #define N 100
  5.  
  6. int main() {
  7. int n;
  8. cin >> n;
  9. int arr[N * N];
  10. for (int i = 0; i < n * n; i++) {
  11. cin >> arr[i];
  12. }
  13. int r, c;
  14. cin >> r >> c;
  15. for (int j = 0; j < r; j++) {
  16. for (int i = j * n; i < c + n * j; i++) {
  17. cout << arr[i] << " ";
  18. } cout << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 15232KB
stdin
5
18 25 34 44 -43
54 65 75 85 -32
95 15 25 35 -3
-4 15 -6 37 0
44 43 23 3 -12
4 3
stdout
18 25 34 
54 65 75 
95 15 25 
-4 15 -6