Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- bool bomb[101][101];
- int cot[101][101];
- int n, m;
- cin >> n >> m;
- for(int i=0;i<n;i++){
- for(int j=0 ;j<m;k++){
- cot[i][j] = 0;
- }
- }
- for(int i=0;i<n;i++){
- for(int j=0;j<m;j++){
- cin >> bomb[i][j];
- }
- }
- for(int i=0;i<n;i++){
- for(int j=0;j<m;j++){
- if(i-1>=0 && i-1 >=0 && bomb[i-1][j-1] == 1) cot[i][j] ++;
- if(i-1>=0 && bomb[i-1][j] == 1) cot[i][j] ++;
- if(i-1>=0 && j+1 < n && bomb[i-1][j] == 1) cot[i][j] ++;
- if(j+1 < n && bomb[i][j+1] == 1) cot[i][j] ++;
- if(i+1 < bomb[i+1][j+1] == 1 )
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement