20分求调
查看原帖
20分求调
1284984
huafan楼主2025/1/18 10:18

样例过了却没逃过20pts的下场

# include <bits/stdc++.h>
using namespace std;
long long k,n,e,d;
int main(){
	cin>>k;
	for(int i=0;i<k;i++){
		scanf("%lld%lld%lld",&n,&e,&d);
		int deta=n-e*d+2,t;
		if((t=deta*deta-4*n)<0) cout<<"NO";
		else if(sqrt(t)!=(t=sqrt(t))) cout<<"NO";
		else if((deta+t)%2||(deta-t)%2) cout<<"NO";
		else cout<<min((deta-t)/2,(deta+t)/2)<<" "<<max((deta-t)/2,(deta+t)/2);
		cout<<endl;
	}
	return 0;
}

2025/1/18 10:18
加载中...