-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtempCodeRunnerFile.cpp
52 lines (47 loc) · 1012 Bytes
/
tempCodeRunnerFile.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
51
52
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void fastscan(int &number)
{
bool negative = false;
register int c;
number = 0;
c = getchar();
if (c=='-')
{
negative = true;
c = getchar();
}
for (; (c>47 && c<58); c=getchar())
number = number *10 + c - 48;
if (negative)
number *= -1;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
fastscan(t);
while(t-->0){
int c = 0, p = -1;
string str;
cin>>str;
int n = str.length();
if (n == 1) {
cout<<"NO"<<endl;
continue;
}
for (int i = 0; i < n; i++) {
if (str[i] == '1') {
c++;
p = i + 1;
}
}
if (c == 0 || (c == 1 && p == n)) {
cout<<"NO";
} else {
cout<<"YES";
}
}
}