My issue
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n ;
cin>>n ;
string a , k ;
cin>>a>>k ;
int p =0 , e =0 , both =0 ;
for(int i= 0 ; i<n ;i++)
{
if(((a[i] == k[i] )&& k[i] =='1') )
both++ ;
else if(a[i] =='1' )
p++;
else if( k[i] =='1' )
e++ ;
}
//cout<<"both"<< both <<" p="<<p<<" e="<<e<<"\n" ;
if(both ==1 && p == 0 && e==0 )
{
cout<<"0\n" ;
continue ;
}
else
{
cout<< min( p , e ) + both <<"\n" ;
}
}
return 0;
}
Problem Link: TEAMFOR Problem - CodeChef