Advertisement
semsem_elazazy

Untitled

Dec 21st, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <iostream>
  3. using namespace std;
  4. int main ()
  5. {
  6.     int n,m;
  7.     cin  >> n >> m;
  8.     char grid [n+2][m+2];
  9.     for (int i=0;i<n+2; i++){
  10.         for (int j=0;j<m+2 ;j++){
  11.             grid[i][j]= 'x';
  12.         }
  13.     }
  14.     for (int i=1 ;i<=n ;i++){
  15.         for (int j =1 ;j<=m ;j++){
  16.             cin >> grid[i][j];
  17.         }
  18.     }
  19.     int i,j;
  20.     cin>>i>>j;
  21.     if (grid[i-1][j-1]=='x' and grid [i-1][j] =='x' and grid [i-1][j+1]=='x' and
  22.         grid[i][j-1]=='x' and grid [i][j+1] =='x' and grid [i+1][j-1]=='x' and
  23.         grid[i+1][j]=='x' and grid [i+1][j+1] =='x' )
  24.         {
  25.             cout << "yes\n";
  26.         }
  27.         else
  28.         {
  29.             cout <<"no\n";
  30.            
  31.         }
  32.         return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement