20pts求调
查看原帖
20pts求调
1005477
zhoubohan624楼主2024/5/8 18:29

交了是2020分,dalaodalao帮帮孩纸吧!

#include<bits/stdc++.h>
using namespace std;
int k,n,d,e,m,a;
int main(){
	cin>>k;
	while(k--){
		cin>>n>>d>>e;
		m=n-d*e+2;
		a=m*m-4*n;
		int b=sqrt(a);
		if(b*b!=a){
			cout<<"NO"<<endl;
			continue;
		}
		if((m+b)%2==1||m<=b){
			cout<<"NO"<<endl;
			continue;
		}
		cout<<(m-b)/2<<' '<<(m+b)/2<<'\n';
	}
	return 0;
} 
2024/5/8 18:29
加载中...