-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppleman and Easy Task.cpp
50 lines (46 loc) · 1.01 KB
/
Appleman and Easy Task.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<bits/stdc++.h>
using namespace std;
int main()
{
long int i,j,n,m,cnt;
while(cin>>n)
{
char a[105][105];
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++)
{
cin>>a[i][j];
}
}
bool f=1;
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++)
{
cnt=0;
cnt=0;
if(a[i][j-1]=='o' && j>1)
cnt++;
if(a[i][j+1]=='o' && j<n)
cnt++;
if(a[i-1][j]=='o' && i>1)
cnt++;
if(a[i+1][j]=='o' && i<n)
cnt++;
if(cnt==1||cnt==3)
{
f=0;
break;
}
}
if(f==0)
break;
}
if(f==1)
cout<<"YES\n";
else
cout<<"NO\n";
}
return 0;
}