/ Randle /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Accepted 1ms 200.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 212.0 KiB
#6 Wrong Answer 1ms 208.0 KiB
#7 Wrong Answer 31ms 208.0 KiB
#8 Wrong Answer 30ms 200.0 KiB
#9 Wrong Answer 32ms 208.0 KiB
#10 Wrong Answer 31ms 196.0 KiB

代码

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

信息

递交者
类型
递交
题目
三向城T1
题目数据
下载
语言
C++
递交时间
2019-12-13 15:25:50
评测时间
2019-12-13 15:25:50
评测机
分数
10
总耗时
134ms
峰值内存
212.0 KiB