暴力60求助
查看原帖
暴力60求助
454444
StenvenPig楼主2023/2/11 17:25
#include<bits/stdc++.h>
using namespace std;
int k;
int main(){
	cin>>k;
	for(int i=1;i<=k;i++){
		int n,d,e;
		cin>>n>>d>>e;
		bool flag=false;
		int x=sqrt(n);
		if(k>1000 and (x-1)*(x-1)+1==d*e and x*x==n){
			cout<<x<<' '<<x<<endl;
			flag=true;
		}else{
			for(int j=1;j*j<=n;j++){
				if(n%j==0 and (j-1)*((n/j)-1)+1==d*e){
					flag=true;
					cout<<j<<' '<<n/j<<endl;
					break;
				}	
			}	
		}
		if(flag==false){
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

2023/2/11 17:25
加载中...