怎么?

B2108 图像模糊处理

```cpp //c++ #include<bits/stdc++.h> using namespace std; double n,m,a[101][101],b[101][101]; 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 || i == n || 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); } } for(int i = 1 ; i <= n ; i++){ for(int j = 1 ; j <= m ; j++){ cout<<b[i][j]<<' '; } cout<<endl; } return 0; } ```
by __Tonycyt__ @ 2024-05-01 16:08:35


感谢大佬!(≧▽≦)
by lucus_Fu0202 @ 2024-05-01 16:24:18


|