-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString3.cpp
More file actions
46 lines (42 loc) · 762 Bytes
/
Copy pathString3.cpp
File metadata and controls
46 lines (42 loc) · 762 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
46
#include<bits/stdc++.h>
using namespace std;
int eqb4(string s)
{
if(s=="00")
return 0;
else if(s=="01")
return 1;
else if(s=="10")
return 2;
else
return 3;
}
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
if(s.length()%2)
s=s+'0';
int odd=0,even=0;
int isdigit=1;
for(int i=0;i<s.length();i=i+2)
{
if(isdigit)
odd+=eqb4(s.substr(i,2));
else
even+=eqb4(s.substr(i,2));
if(isdigit)
isdigit=0;
else
isdigit=1;
}
if(abs((even-odd)%5==0))
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}