70分求调!!!
查看原帖
70分求调!!!
879604
fupincheng楼主2024/12/24 13:20
#include<bits/stdc++.h>
using namespace std;
double n,m,v[1009][1009],l[1009][1009];
signed main(void){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>l[i][j];
			v[i][j]=l[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(!i||!j||i==n-1||j==m-1){
				v[i][j]=l[i][j];
			}else{
				v[i][j] = round((l[i][j]+l[i-1][j]+l[i+1][j]+l[i][j-1]+l[i][j+1])/5.0);
			}
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cout<<v[i][j]<<' ';
		}
		printf("\n");
	}
	return 0;
}
/*
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
*/

4、5、8点都wa了

2024/12/24 13:20
加载中...