@[gjx803](/user/1267891) 论题解是干什么用的
by heyx0201 @ 2024-07-20 13:00:09
@[gjx803](/user/1267891) $这题就简单的大模拟,多练练就会了$
by y6hz @ 2024-08-02 09:05:42
```cpp
#include <stdio.h>
#include <math.h>
int main() {
int m,n;
scanf("%d %d",&m,&n);
int matrix[m][n],b[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
scanf("%d",&matrix[i][j]);
}
}
for (int i = 1; i < m-1; i++) {
for (int j = 1; j < n-1; j++) {
b[i][j]=round((matrix[i-1][j]+matrix[i][j]+matrix[i+1][j]+matrix[i][j-1]+matrix[i][j+1])/5.0);
}
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (i > 0 && i < m - 1 && j > 0 && j < n - 1) {
matrix[i][j] = b[i][j];
}
}
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
printf("%d",matrix[i][j]);
if(j<n-1)
{
printf(" ");
}
}
printf("\n");
}
return 0;
}
```
by tuonisitake @ 2024-09-28 23:53:24