一本通1128

#include <bits/stdc++.h>
#define rep(i,j,n) for(register int i=j;i<=n;i++)
#define Rep(i,j,n) for(register int i=j;i>=n;i--)
#define low(x) x&(-x)
using namespace std ;
typedef long long LL ;
const int inf = INT_MAX >> 1 ;
inline LL In() {
	LL res(0) , f(1) ;
	register char c ;
#define gc c = getchar()
	while(isspace(gc)) ;
	c == '-' ? f = - 1 , gc : 0 ;
	while(res = (res << 1) + (res << 3) + (c & 15) , isdigit(gc)) ;
	return res * f ;
#undef gc
}

int n , m ;
int a[101][101];
double b[101][101];
inline void Ot() {
	n = In() , m = In() ;
	rep(i,1,n) rep(j,1,m) a[i][j] = In() ;
	rep(i,1,n) {
		rep(j,1,m)
			if((i==1||i==n||j==1||j==m)) b[i][j]=a[i][j];
			else b[i][j]=round((a[i][j]+a[i-1][j]+a[i+1][j]+a[i][j-1]+a[i][j+1])/5.0);
	}
	rep(i,1,n) {
		rep(j,1,m) cout<<b[i][j]<<" ";
		puts("") ;
	}
}
signed main() {
//  freopen("test.in","r",stdin) ;
	return Ot() , 0 ;
}
posted @ 2019-04-13 00:59  Isaunoya  阅读(273)  评论(0编辑  收藏  举报
TOP