-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1566B MIN-MEX Cut.cpp
51 lines (50 loc) · 963 Bytes
/
1566B MIN-MEX Cut.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
/*
author : MishkatIT
created : Monday 2022-12-05-02.56.17
problem : 1566 B. MIN-MEX Cut
*/
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
fio;
int t;
cin >> t;
while(t--)
{
string str;
cin >> str;
int zero = 0;
int one = 0;
bool ok = true;
for(auto i: str)
{
if(i == '0')
{
if(ok)
zero++;
ok = false;
}
else
{
one++;
ok = true;
}
if(zero > 1)
break;
}
int ans;
if(one == str.length())
ans = 0;
else
{
if(zero > 1)
ans = 2;
else
ans = 1;
}
cout << ans << '\n';
}
return 0;
}