Type: Default 1000ms 128MiB

图像模糊处理

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

来源

信息学奥赛一本通 二维数组 洛谷

2025-11-09周训练

Not Attended
Status
Done
Rule
XCPC
Problem
10
Start at
2025-11-9 14:00
End at
2025-11-9 17:00
Duration
3 hour(s)
Host
Partic.
26