Wrong Answer
代码
#include<bits/stdc++.h>
using namespace std;
int dx,dy,n;
int main()
{
int n;
cin>>n;
while (n--)
{
int x,y;
cin>>x>>y;
dx=log2(x);
dy=log2(y);
if (dx<dy)
{
swap(dx,dy),swap(x,y);
}
int ans=0;
for (int i=dx;i>=dy;i--)
x/=2,ans++;
while (x!=y)
x/=2,y/=2,ans+=2;
cout<<ans-3<<endl;
}
}