Skip to content

Commit 78a959e

Browse files
authored
added COVIDq
1 parent deb3952 commit 78a959e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

CodeChef_problems/COVIDq_CodeChef.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
// your code goes here
6+
int T;
7+
cin>>T;
8+
while(T--)
9+
{
10+
int N;
11+
int flag=0;
12+
cin>>N;
13+
int arr[N];
14+
for(int i=0;i<N;i++)
15+
{
16+
cin>>arr[i];
17+
18+
}
19+
for(int j=0;j<N;j++)
20+
{
21+
if(arr[j]==1)
22+
{
23+
for(int k=j+1;k<=j+5 && k<N;k++)
24+
{
25+
if(arr[k]==1)
26+
{
27+
28+
flag=1;
29+
break;
30+
}
31+
32+
}
33+
}
34+
if(flag==1)
35+
break;
36+
}
37+
if(flag==0)
38+
cout<<"YES"<<endl;
39+
else
40+
cout<<"NO"<<endl;
41+
}
42+
return 0;
43+
}
44+

0 commit comments

Comments
 (0)