| 比赛 | 
    20150408 | 
    评测结果 | 
    ATTTTTTTTTT | 
    | 题目名称 | 
    所有进制 | 
    最终得分 | 
    9 | 
    | 用户昵称 | 
    小DOTA | 
    运行时间 | 
    10.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.26 MiB  | 
    | 提交时间 | 
    2015-04-08 20:56:33 | 
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
inline int judge(int a,int x){
	int ans=0,s[3];
	for (int i=0; i<=2; i++) s[i]=a%10,a/=10;
	for (int i=3; i--;) ans=ans*x+s[i];
	return ans;
}
int main(){
	freopen("whatbase.in","r",stdin);
	freopen("whatbase.out","w",stdout);
	int k,a,b,i=10,j=10;
	scanf("%d",&k);
	while (k--){
		scanf("%d%d",&a,&b);
		while (judge(a,i)!=judge(b,j)){
			while (judge(a,i)>judge(b,j)) j++;
			i++;
		}
		printf("%d %d\n",i,j);
	}
	return 0;
}