#include<stdio.h>
#include <stdlib.h>
int main()
{
int a,b,count=0;
scanf("%d %d",&a,&b);
int arr1[101],m=0,arr2[101],n=0;
while(a>0){
arr1[m]=a%2;
a/=2;
m++;}
while(b>0){
arr2[n]=b%2;
b/=2;
n++;}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
if(i==j){
if(arr1[i]!=arr2[j]){
printf("%d",i+1);
i=m;
j=n;
count++;
} }
}
}
if(count==0){
printf("-1");}
}
Subscribe to:
Posts (Atom)
Just Give Your Feedback ConversionConversion EmoticonEmoticon