SHARE
TWEET

Untitled

a guest Apr 19th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     bool bomb[101][101];
  7.     int cot[101][101];
  8.     int n, m;
  9.     cin >> n >> m;
  10.     for(int i=0;i<n;i++){
  11.         for(int j=0 ;j<m;k++){
  12.             cot[i][j] = 0;
  13.         }
  14.     }
  15.     for(int i=0;i<n;i++){
  16.         for(int j=0;j<m;j++){
  17.             cin >> bomb[i][j];
  18.         }
  19.     }
  20.     for(int i=0;i<n;i++){
  21.         for(int j=0;j<m;j++){
  22.             if(i-1>=0 && i-1 >=0 && bomb[i-1][j-1] == 1) cot[i][j] ++;
  23.             if(i-1>=0 && bomb[i-1][j] == 1) cot[i][j] ++;
  24.             if(i-1>=0 && j+1 < n && bomb[i-1][j] == 1) cot[i][j] ++;
  25.             if(j+1 < n && bomb[i][j+1] == 1) cot[i][j] ++;
  26.             if(i+1 < bomb[i+1][j+1] == 1 )
  27.         }
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top