Wrong Answer
代码
#include<bits/stdc++.h>
#define fre(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout)
using namespace std;
int n;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
int x,y,ans=0;
scanf("%d%d",&x,&y);
int depx=log2(x)+1,depy=log2(y)+1;
if(depx<depy) swap(x,y),swap(depx,depy);
for(int j=depx;j<depy;j++) x/=2,ans++;
for(int j=log2(y);j>=1;j--)
{
if(x==y) break;
x/=2;
y/=2;
ans+=2;
}
printf("%d\n",ans);
}
return 0;
}