Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <memory>
- using namespace std;
- int main() {
- int row, col, r, c;
- cin >> row >> col;
- int matrixElements = row * col;
- unique_ptr<int[]> matrix = make_unique<int[]>(matrixElements);
- for (int i = 0; i < matrixElements; i++) {
- cin >> matrix[i];
- }
- cin >> r >> c;
- for (int i = 0; i < r; i++) {
- for (int j = 0; j < c; j++) {
- cout << matrix[i * col + j] << ' ';
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement