I got 10 points on the below solution for the BINXOR problem. Can’t figure out what it’s going wrong with.
Yes, I’m a noob, thanks for helping out.
using namespace std;
long long int f[100000]={0};
long long int fact(int n)
{
if(f[n]==0)
f[n]=(n*fact(n-1)) % 1000000007;
//cout<<f[n]<<endl;
return f[n];
}
int main()
{
int t;
f[0]=f[1]=1;
cin>>t;
while(t--)
{
int n,m0,m1,n0,n1,i,min,max;char a[100000],b[100000];
long long int s=0;
cin>>n;
cin>>a;
cin>>b;
for(i=0,m0=m1=n0=n1=0;i<n;i++)
{
if(a[i]=='1')
m1++;
else if(a[i]=='0')
m0++;
if(b[i]=='1')
n1++;
else if(b[i]=='0')
n0++;
}
if(m1>n1)
min=m1-n1;
else
min=n1-m1;
if(m1+n1>m0+n0)
max=m0+n0;
else
max=m1+n1;
for(i=min;i<=max;i+=2)
{
s+=(fact(n)/(fact(i)*fact(n-i)));
}
cout<<s%1000000007<<endl;
}
}