/ Randle /

记录详情

Accepted


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

代码

#include<bits/stdc++.h>
#define fre(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout);
#define Fre(x,y) freopen(#x".in","r",stdin); freopen(#y".out","w",stdout);

#define IsDigit(c) ('0'<=(c) && (c)<='9')

#define MAX 5 +

#define Enter putchar('\n');
#define Space putchar(' ');
#define LL long long
#define INF 1<<30
#define p

using namespace std;

inline int read()
{
	int x=0; bool f=true;
	char c=getchar();
	for (;!IsDigit(c);c=getchar()) if (c=='-') f=false;
	for (;IsDigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
	return f ? x : -x;
}
inline void write(int x)
{
    if (x<0)
	{
        putchar('-');
		x=-x;
	}
    if (x>9) write(x/10);
	putchar(x%10+'0');
}

int n,Ans;

signed main()
{
//	fre();

	n=read();
	for (register int x,y,i=1;i<=n;i++)
	{
		x=read(); y=read();
		Ans=0;
		while (x!=y)
		{
			Ans++;
			if (x<y) swap(x,y);
			x/=2;
		}
		write(Ans); Enter;
	}

	return 0;
}

信息

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