#K36242. Grid Transformation
Grid Transformation
Grid Transformation
You are given an (n \times m) grid of integers and an integer multiplier (k). Your task is to multiply each element in the grid by (k) and then remove any row that consists entirely of zeros as well as any column that consists entirely of zeros. Formally, after computing (A_{ij} = k \times grid_{ij}), remove every row (i) for which (\forall j, A_{ij} = 0) and then remove every column (j) for which (\forall i, A_{ij} = 0). If no rows remain, output nothing.
The input is read from standard input and the output must be printed to standard output. Each row of the resulting grid should be printed on a separate line with single space separated integers.
inputFormat
The first line contains three integers (n), (m), and (k), where (n) is the number of rows and (m) is the number of columns in the grid. The next (n) lines each contain (m) integers representing the grid.
outputFormat
Print the transformed grid after performing the operations. Each row should be printed on a separate line with values separated by a single space. If the resulting grid is empty, print nothing.## sample
3 4 2
1 0 3 -2
4 -2 0 0
0 0 0 0
2 0 6 -4
8 -4 0 0
</p>