Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrounding cells and itself. If a cell has less than 8 surrounding cells, then use as many as you can.
输入
The first row gives two positive integers n, m separated by spaces, representing the rows and columns of the matrix (1≤n, m≤128)
Next output n-row, m-column, represents matrix M and the value in the given matrix is in the rangeof [0, 255].
输出
Output smoothed n-rows, m-column matrix M, no extra spaces at the end of each row
样例
标准输入 复制文本 |
3 3 1 1 1 1 0 1 1 1 1 |
标准输出 复制文本 |
0 0 0 0 0 0 0 0 0 |
来源
SCNUCPC 2020 现场赛