有没有一种可能,数组开小了
by glx123 @ 2023-08-30 15:15:31
```
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,x,y;
long long a[101][101]={0},b[101][101]={0};
cin>>x>>y;
for(i=1;i<=x;i++)
{
for(j=1;j<=y;j++)
{
cin>>a[i][j];
}
}
for(i=1;i<=x;i++)
{
for(j=1;j<=y;j++)
{
if(i==1||j==1||i==x||j==y)
{
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);
}
cout<< b[i][j]<<' ';//其实不一定要保存下来
}
cout<< endl;
}
return 0;
}
```
by glx123 @ 2023-08-30 15:16:32
@[liuyinuo666](/user/1059565)
by glx123 @ 2023-08-30 15:32:00
@[glx123](/user/991551)
谢谢!可以过了
by liuyinuo666 @ 2023-08-30 19:14:26