#include<bits/stdc++.h>
using namespace std;
double a[105][105],b[105][105];
int n,m;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(i==1||j==1||j==m||i==n){
b[i][j]=a[i][j];
}
else{
b[i][j]=round((a[i+1][j]+a[i-1][j]+a[i][j+1]+a[i][j-1]+a[i][j])/5.0);
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cout<<b[i][j]<<" ";
}
cout<<endl;
}
return 0;
}```c
```
by sunny2014 @ 2024-01-23 14:55:23