一个关注
by xuyangming @ 2024-07-30 09:17:21
@[xuyangming](/user/1105563) 你确定这是这道题的代码。。。
by run_away @ 2024-07-30 09:20:24
@[run_away](/user/964089) 什么意思
by xuyangming @ 2024-07-30 09:23:54
@[xuyangming](/user/1105563) 你这个输入格式都不对吧
by run_away @ 2024-07-30 09:29:11
@[xuyangming](/user/1105563) 先不说内容,输入输出明显不匹配啊
by JOE_ZengYuQiao_0928 @ 2024-07-30 09:29:24
6
by zqrmon @ 2024-07-30 09:30:15
怎么发代码
by zqrmon @ 2024-07-30 09:32:09
```
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[n][m];
double b[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> a[i][j];
if(i==0 or i==n-1 or j==0 or j==m-1)
{
b[i][j]=a[i][j];
}
}
}
for (int i = 1; i < n - 1; i++) {
for (int j = 1; j < m - 1; j++) {
b[i][j] = (a[i - 1][j] + a[i][j - 1] + a[i][j + 1] + a[i + 1][j]+a[i][j]) / 5.0;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << round(b[i][j]) << " ";
}
cout << endl;
}
return 0;
}
```
by zqrmon @ 2024-07-30 09:38:05
@[xuyangming](/user/1105563)
by zqrmon @ 2024-07-30 09:42:11
@[zqrmon](/user/1024331) c++最好用||,尽量不用or
by chenxitao @ 2024-10-22 12:37:14