/ Randle /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 204.0 KiB
#2 Wrong Answer 1ms 208.0 KiB
#3 Wrong Answer 1ms 212.0 KiB
#4 Wrong Answer 1ms 204.0 KiB
#5 Wrong Answer 1ms 208.0 KiB
#6 Wrong Answer 1ms 204.0 KiB
#7 Wrong Answer 6ms 212.0 KiB
#8 Wrong Answer 6ms 200.0 KiB
#9 Wrong Answer 6ms 268.0 KiB
#10 Wrong Answer 6ms 200.0 KiB

代码

#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;
}

信息

递交者
类型
递交
题目
三向城T1
题目数据
下载
语言
C++
递交时间
2019-12-13 15:20:57
评测时间
2019-12-13 15:20:57
评测机
分数
0
总耗时
33ms
峰值内存
268.0 KiB