-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy path1549B.cpp
More file actions
35 lines (32 loc) · 741 Bytes
/
1549B.cpp
File metadata and controls
35 lines (32 loc) · 741 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
question link : - https://codeforces.com/contest/1549/problem/B
Solution: -
#include<bits\stdc++.h>
using namespace std;
int32_t main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string a ,b;
cin>>a>>b;
int cnt=0;
for(int i=0; i<n; i++){
if(b[i]=='1'){
if(a[i]=='0') cnt++;
else{
if(a[i-1]=='1'){
cnt++;
a[i-1]='0';
}
else if(a[i+1]=='1'){
cnt++;
a[i+1]='0';
}
}
}
}
cout<<cnt<<endl;
}
return 0;
}