-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
45 lines (36 loc) · 867 Bytes
/
sol.cpp
File metadata and controls
45 lines (36 loc) · 867 Bytes
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
#include <bits/stdc++.h>
using namespace std;
int main(){
int flag;
int flag2;
int t;
cin >> t;
for(int test=0;test<t;test++){
char arr[100];
cin >> arr;
flag = 0;
flag2 = 0;
for (int i = 0; arr[i] != '\0'; i++)
{
if (arr[i] != '0')
{
if (flag != 0)
{
cout << "NO" << endl;
flag2 = 1;
break;
}
flag = 1;
}
else{
flag = 0;
}
}
if (flag2)
{
continue;
}
cout << "YES" << endl;
}
return 0;
}