代码如下:
#include <iostream>
using namespace std;
int main()
{
int k;
cin >> k;
for (int i = 1; i <= k; ++i)
{
long long n;
int e, d;
cin >> n >> e >> d;
bool is_find = 0;
for (int p = 1; p * p <= n; ++p)
{
if (n % p != 0) continue;
if (e * d == (p - 1) * (n / p - 1) + 1)
{
is_find = 1;
cout << p << " " << n / p;
break;
}
}
if (!is_find) cout << "No";
cout << endl;
}
return 0;
}