Skip to content

Instantly share code, notes, and snippets.

@harrypotter0
Created October 15, 2016 03:09
Show Gist options
  • Save harrypotter0/c39f0bdfbf735cdffda22bcb86ca83cd to your computer and use it in GitHub Desktop.
Save harrypotter0/c39f0bdfbf735cdffda22bcb86ca83cd to your computer and use it in GitHub Desktop.
#include<iostream>
char A[101][101],i,j; int s,n;
int main(){
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%s",A[i] + 1);
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(A[i][j] == '#' && A[i][j+1] == '#' && A[i+1][j] == '#' && A[i][j-1] == '#' && A[i-1][j] == '#')
A[i][j] = A[i][j+1] = A[i+1][j] = A[i][j+1] = A[i+1][j] = 0, s += 5;
else if(A[i][j] == '.') s++;
printf(s == n * n ? "YES" : "NO");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment