随便推了个乱七八糟的东西,很好奇这是怎么过的
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define R register
namespace IO{
char ibuf[(1<<20)+1],*iS,*iT;
#if ONLINE_JUDGE
#define gh() (iS==iT?iT=(iS=ibuf)+fread(ibuf,1,(1<<20)+1,stdin),(iS==iT?EOF:*iS++):*iS++)
#else
#define gh() getchar()
#endif
inline long long read(){
R char ch=gh();
R long long x=0;
R char t=0;
while(ch<'0'||ch>'9') t|=ch=='-',ch=gh();
while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=gh();
return t?-x:x;
}
}
using IO::read;
void write(long long x) {
if(x<0){
putchar('-');
write(-x);
return;
}
if(x>=10)write(x/10);
putchar(x%10+'0');
}
long long x,y,n,m,t,f;
signed main(){
t=read();
while(t--){
f=-1;
n=read();m=read();
if(n<m){
puts("-1");
continue;
}
y=n-m;x=m;
if(y&&x%y==m){
write(x);
putchar(' ');
write(y);
puts("");
continue;
}
for(long long i=1;i*i*i*i*i<=n;i++)//原本是i*i<=n
if(n-m==(1+(n-i)/i)*i){
write(n-i);
putchar(' ');
write(i);
puts("");
f=0;
break;
}
if(f) puts("-1");
}
return 0;
}