超时了怎么改啊
60分求条
#include <bits/stdc++.h>
#define int long long
using namespace std;
int k;
int n,d,e,a,p=1,q;
bool f=false;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>k;
while(k--){
p=1;
cin>>n>>d>>e;
a=e*d;
while(p<=sqrt(n)){
q=n/p;
if(q*p==n){
if((p-1)*(q-1)+1==a){
f=!f;
break;
}
}
p++;
}
if(f){
cout<<p<<" "<<q<<endl;
f=!f;
}else{
cout<<"NO"<<endl;
}
}
return 0;
}