


代码
#include <bits/stdc++.h>
using namespace std;
long long m,n;
int check(int x){
if(x * (m - x) == n) return 0;
if(x * (m - x) < n) return 1;
if(x * (m - x) > n) return 2;
}
int main(){
int k;
cin >> k;
while(k--){
long long e, d,p=0,q=0;
scanf("%lld%lld%lld",&n,&e,&d);
m = n - e*d + 2;
int l = 0, r = m;
while(l < r){
int mid = (l + r) >> 1;
if(!check(mid)){
if(mid > m - mid){
p = (m - mid),q = mid;
}else{
p = mid;
q = (m-mid);
}
printf("%lld %lld\n",p,q);
break;
}else if(check(mid)== 1){
l = mid+1;
}else{
r = mid;
}
}
if(!p && !q){
printf("NO\n");
}
}
return 0;
}
记得点赞+关注+收藏!!!谢谢!!!