1 solutions
-
0
#include<bits/stdc++.h> using namespace std; int n,m,x,y,a[110][110]; string c; void bom(int q,int w) { if(a[q][w]==1) { a[q][w]=2; bom(q+1,w+1); bom(q+1,w-1); bom(q-1,w+1); bom(q-1,w-1); bom(q,w+1); bom(q,w-1); bom(q+1,w); bom(q-1,w); } else { a[q][w]=2; } } int main() { cin>>n>>m; for(int i=1;i<=n;i++) { cin>>c; for(int j=1;j<=m;j++) { a[i][j]=c[j-1]-48; //cout<<a[i][j]<<" "; } //cout<<endl; } cin>>x>>y; if(a[x][y]==1) { bom(x,y); } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { cout<<a[i][j]; } cout<<endl; } return 0; }
- 1
Information
- ID
- 308
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 10
- Tags
- # Submissions
- 2
- Accepted
- 1
- Uploaded By