Advertisement
basystyi

Untitled

Apr 9th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. long long a1,b1,i,j,c;
  5. char a[101][101];
  6. int main()
  7. {
  8.     cin >> a1 >> b1;
  9.     for(i=1;i<=a1;i++){
  10.         for(j=1;j<=b1;j++){
  11.             cin >> a[i][j];
  12.         }
  13.     }
  14.     for(i=1;i<=a1;i++){
  15.         for(j=1;j<=b1;j++){
  16.             if(a[i+1][j]!='*' && a[i][j+1]!='*' && a[i-1][j]!='*' && a[i][j-1]!='*') c++;
  17.         }
  18.     }
  19.     cout << c;
  20. }
  21.  
  22. /*4x4
  23. . . . .
  24. . . . .
  25. . . . .
  26. . . . .*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement