题目
测试结果
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
ll t,n1,n2,e,d;
signed main(){
std::ios::sync_with_stdio(0);
std::cin.tie(0);
cin>>t;
while(t--){
cin>>n1>>e>>d;
n2=e*d;
ld a=1.0,b=(n2-n1-2)*1.0,c=n1*1.0,x;
if( b*b-4.0*a*c<0 || c/a<0 || b*-1.0/a<0 ){
cout<<"NO\n";
continue;
}
x=( -1.0*b - sqrt(b*b-4.0*a*c) )/(a*2.0);
if( ld(ll(x))==x ) cout<<ll(x)<<" "<<ll(n1/x)<<'\n';
else cout<<"NO\n";
}
}