#Z15210. 图像模糊处理

图像模糊处理

Description

Given an image with n rows and m columns of pixel grayscale values, perform the following blurring process:

  1. The grayscale values of the outermost pixels remain unchanged.
  2. For the middle pixels, the new grayscale value is the average (rounded to the nearest integer) of the original grayscale values of the pixel and its four adjacent pixels (up, down, left, and right).

Input Format

The first line contains two integers n and m, representing the number of rows and columns of pixels in the image. (1 ≤ n ≤ 100, 1 ≤ m ≤ 100).
The next n lines each contain m integers, representing the grayscale values of each pixel in the image. Adjacent integers are separated by a single space, and each value is between 0 and 255.

Output Format

Output n lines, each containing m integers, representing the blurred image. Adjacent integers should be separated by a single space.

Note: The output description in the original Chinese text had a typo ("m行,每行n个整数" should be "n行,每行m个整数" to match the input format). The translation has been corrected to reflect this.

4 5
100 0 100 0 50
50 100 200 0 0
50 50 100 100 200
100 100 50 50 100


100 0 100 0 50
50 80 100 60 0
50 80 100 90 200
100 100 50 50 100