for(i=min;i<=max;i++)
{
j=0;
for(k=0,l=0;k<n2 || l<n1;k++,l++)
{
if(arr2[k]%i!=0 || i%arr1[l]!=0)
break;
else
j+=1;
}
if(j==n2 && l==n1)ans+=1;
- I am getting correct answer if length of arr1 and arr2 are same.
- But getting wrong answer if different length of arr1 and arr2 are different.
- I know what I have written is wrong but how can get correct answer is length of arr1 and arr2 are different.
P.S. This is my first question and I don't know how ask question properly so, sorry for that.
Aucun commentaire:
Enregistrer un commentaire