-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrgame.cpp
More file actions
57 lines (54 loc) · 1.07 KB
/
Copy patharrgame.cpp
File metadata and controls
57 lines (54 loc) · 1.07 KB
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
51
52
53
54
55
56
57
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=1;i<=t;i++)
{
int n;
cin>>n;
int a[n];
for(int j=0;j<n;j++)
{
cin>>a[j];
}
int count=0,check=0,yes=0;
for(int j=n-1;j>=0;j--)
{
if(a[j]==0 && a[j-1]==0 && a[j-2]==0)
{
yes=1;
check=1;
break;
}
else if(a[j]==0 && a[j-1]==0)
{
yes=0;
check=1;
break;
}
else if(a[j]==0)
{
yes=1;
check=1;
break;
}
}
if(check==0)
{
cout<<"No"<<endl;
}
else
{
if(yes==1)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
}
}