| 记录编号 | 
        157681 | 
        评测结果 | 
        AAAAAAAAAAA | 
    
    
        | 题目名称 | 
        1928.[USACO Jan15] 所有进制 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         wolf. | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        1.046 s  | 
    
    
        | 提交时间 | 
        2015-04-09 18:39:03 | 
        内存使用 | 
        0.31 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<iostream>
#include<fstream>
#include<bitset>
#include<vector>
#include<deque>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdio>
using namespace std;
#if defined wolf
const string ok="OK";
const string kk="	";
ofstream nnew("whatbase.in",ios::app);
ifstream fin("whatbase.in");
#define fout cout
#define Endl endl
#else
ifstream fin("whatbase.in");
ofstream fout("whatbase.out");
#endif
void core(int a,int b){
	bool io=0;
	if(a<b){
		io=1;
		swap(a,b);
	}
	map<long long,int> hash;
	int ac=a%10,ab=((a-ac)%100)/10,aa=a/100;
	int bc=b%10,bb=((b-bc)%100)/10,ba=b/100;
	//cout<<aa<<kk<<ab<<kk<<ac<<endl;
	//cout<<ba<<kk<<bb<<kk<<bc<<endl;
	for(int i=11;i!=15001;++i){
		long long p1;
		p1=aa*i*i+ab*i+ac;
		//cout<<p1<<"  ";
		hash[p1]=i;
		long long p2;
		p2=ba*i*i+bb*i+bc;
		//cout<<p2<<endl;
		if(hash.find(p2)!=hash.end()){
			if(io){
				fout<<i<<"  "<<hash[p2]<<endl;
			}else{
				fout<<hash[p2]<<"  "<<i<<endl;
			}
			return;
		}
	}
	fout<<12000<<"  "<<11000<<endl;
}
int main(){
	int k;
	fin>>k;
	for(int i=0;i!=k;++i){
		int a,b;
		fin>>a>>b;
		core(a,b);
	} 
	//-------------------------*/
	#if defined wolf
	cout<<endl<<(double)clock()/CLOCKS_PER_SEC<<'s'<<endl;
	#endif
	return 0;
}
//Designed by wolf
//Wed Apr 08 2015