话不多说,上代码
#include<bits/stdc++.h>
using namespace std;
long long k,n,d,e;
int main()
{
ios::sync_with_stdio(0);//加速
cin.tie(0);
cout.tie(0);
cin>>k;
while(k--)
{
cin>>n>>d>>e;
long long m=n-d*e+2;
long long k=m*m-4*n;
long long k1=sqrt(k);
if(k1*k1!=k)
{
cout<<"NO"<<'\n';
continue;
}
if((m+k1)%2==1||m<=k1)
{
cout<<"NO"<<'\n';
continue;
}
cout<<(m-k1)/2<<' '<<(m+k1)/2<<'\n';
}
return 0;//功德圆满
}