25 lines
555 B
C++
25 lines
555 B
C++
|
#include <iostream>
|
||
|
#include <cmath>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
#define ll long long
|
||
|
|
||
|
int main() {
|
||
|
ll k;
|
||
|
cin >> k;
|
||
|
while (k--) {
|
||
|
ll n, d, e;
|
||
|
cin >> n >> d >> e;
|
||
|
ll base1 = n - e * d + 2;
|
||
|
ll var1 = sqrt(base1 * base1 - 4 * n);
|
||
|
ll var2 = n - e * d + 2;
|
||
|
ll p = (var2 + var1) / 2;
|
||
|
ll q = var2 - p;
|
||
|
if (p * q == n && e * d == (p - 1) * (q - 1) + 1 && p && q) {
|
||
|
cout << min(p, q) << " " << max(p, q) << endl;
|
||
|
} else {
|
||
|
cout << "NO" << endl;
|
||
|
}
|
||
|
}
|
||
|
}
|