Solution in Python
https://www.codechef.com/viewsolution/14011703
@dpraveen, @kingofnumbers
can we have the test cases now that test is over and we cannot even submit to check if our approach is correct.
why my code is giving wrong answer … plz help
#include
#include
using namespace std;
int main()
{
int t,n,i,counta,countb,j,k,ans;
cin>>t;
while(t–)
{
cin>>n;
char a=(char)malloc((n+1)sizeof(char)),b=(char)malloc(sizeof(char)(n+1));
cin>>a>>b;
i=0;j=0;counta=0;countb=0;ans=0;
for(k=0;k<n;k++)
{
if(a[k]==’’)
{
counta++;
i++;
}
if(b[k]==’’)
{
countb++;
j++;
}
if(i>1&&j>1)
{
ans++;
i=1;j=1;
}
else if(i>1 && j<2)
{
ans++;
i=1;
j=0;
}
else if(i<2 && j>1)
{
ans++;
j=1;i=0;
}
}
if(counta>0 && countb>0)
ans++;
cout<<ans<<endl;
}
return 0;
}