Last active
December 27, 2018 14:09
-
-
Save mangafas/07a3b5b51f0b2193a02793d84da57ebc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(){ | |
int m,k,n,c; | |
cin >> m >> n >> k; | |
int arr[m][k], ar[m][k]; | |
char r; | |
for(int i=0;i<m;i++){ | |
for(int j=0;j<k;j++){ | |
cin >> r; | |
if(c=='.') | |
arr[i][j] = 0; | |
else | |
arr[i][j] = 1 | |
}} | |
for(int q=0;q<m;q++){ | |
for(int w=0;w<m;w++){ | |
if(arr[i][j]==0){ | |
if(q=0&&w=0){ | |
if(arr[i][j+1]){ | |
c++; | |
} | |
if(arr[i][j-1]){ | |
c++; | |
}} | |
else if(q=0){ | |
if(arr[i][j+1]){ | |
c++; | |
} | |
if(arr[i][j-1]){ | |
c++; | |
}} | |
else{ | |
if(arr[i][j+1]){ | |
c++; | |
} | |
if(arr[i][j-1]){ | |
c++; | |
} | |
if(arr[i+1][j]){ | |
c++; | |
} | |
if(arr[i-1][j]){ | |
c++; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment