比赛 20150408 评测结果 WWWWWWWWWWW
题目名称 所有进制 最终得分 0
用户昵称 wolf. 运行时间 0.494 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2015-04-08 21:32:39
显示代码纯文本
#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<<hash[p2]<<"  "<<i<<endl;
			}else{
				fout<<i<<"  "<<hash[p2]<<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