-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArranging Cats
49 lines (43 loc) · 1.15 KB
/
Arranging Cats
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
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define dbg(x) cout << #x << " = " << x << "\n";
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define srt(s) sort(all(s))
#define S size()
#define f(i,m,n) for(ll i=m;i<n;i++)
#define nf(i,b,a); for(ll i=(b);i>=(a);i--)
#define llv(a,n) vector<ll> a(n,0); for(ll i=0;i<n;i++) cin>>a[i];
#define test(v) for(auto i:v) cout<<i<<' '; cout<<endl;
//__builtin_popcountll(x)
//msb 63 - __builtin_clzll(x) most(largest)
//lsb __builtin_ctzll(x)
//think again
void solve(){
ll a; cin>>a; string s,q; cin>>s>>q;
ll c=0, cc=0;
f(i,0,a){
if(s[i]=='1' and q[i]=='0'){
c++;
}else if(s[i]=='0' and q[i]=='1'){
cc++;
}
}
cout<<min(c,cc)+abs(cc-c)<<endl;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
ll t;cin>>t;
while(t--)
solve();
return 0;
}