Xorin is on a mission to detect misdeeds in his town. He has a photograph representing the face of his prime suspect, Sin Ming. Sin Ming is very sneaky, and Xorin only managed to take a picture of him from the distance.
Xorin needs a magnifier to identify the features of his face. An image is given as a bidimensional table, where each element represents a pixel. Xorin wants to magnify the image X times, that is, to replace each pixel by a square X by X matrix.
Help Xorin uncover Sin Ming and save his small town.
Input
The first line contains integers N, M and X, separated by spaces, where N and M are the number of lines and columns of the matrix. The next N lines contain M natural numbers each, separated by spaces, representing the pixels of the image.Output
A bidimensional table representing the magnified image. Each row of the table should be on a separate line in the output file, and the elements of each row should be separated by exactly one space character.
Constraints
- 1 ≤ N, M ≤ 100
- 1 ≤ X ≤ 20
- Each pixel is an integer from 0 to 9 inclusive.
Sample
Input | Output |
---|---|
2 2 3 1 2 3 4 | 1 1 1 2 2 2 1 1 1 2 2 2 1 1 1 2 2 2 3 3 3 4 4 4 3 3 3 4 4 4 3 3 3 4 4 4 |
This problem requires a straight-forward approach:
1 for(int i=0; i<n; ++i) { 2 for(int j=0; j<m; ++j) { 3 cin>>in[i][j]; 4 for(int new_i=0; new_i<x; ++new_i) 5 for(int new_j=0; new_j<x; ++new_j) 6 ans[i*x+new_i][j*x+new_j] = in[i][j]; 7 } 8 }