#C. 二级202109-3图像处理

    Type: Default 1000ms 256MiB

二级202109-3图像处理

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

给定 n 行 m 列的图像各像素点的灰度值,要求用如下方法对其进行模糊化处理:

  1. 四周最外侧的像素点灰度值不变;
  2. 中间各像素点新灰度值为该像素点及其上下左右相邻四个像素点原灰度值的平均(舍入到最接近的整数)。

输入

第一行包含两个整数 n 和 m,表示图像包含像素点的行数和列数。1 <= n <= 100,1 <= m<= 100。 接下来 n 行,每行 m 个整数,表示图像的每个像素点灰度。相邻两个整数之间用单个空格隔开,每个元素均在 0~255 之间。

输出

n 行,每行 m 个整数,为模糊处理后的图像。相邻两个整数之间用单个空格隔开。

样例输入

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

二级第6轮

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
5
Start at
2023-7-30 22:15
End at
2023-8-19 2:15
Duration
460 hour(s)
Host
Partic.
9