#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
using namespace std;
vector<int> t;
bool notPrime[100002]={false};
int main()
{
int m,a,b,max=0,rp=0,rq=0;
notPrime[1] = true;
for(int i=2;i*i<=100000;i++)
{
if(!notPrime[i])
{
for(int j=i*i;j<=100000;j+=i)
notPrime[j] = true;
}
}
for(int l=2;l<=100000;++l)
if(!notPrime[l]) t.push_back(l);
while(scanf("%d%d%d",&m,&a,&b))
{
if(m==0&&a==0&&b==0)
break;
for(int p=0;t[p]*t[p]<=m;p++)
{
for(int q=p;t[q]<=m/t[p];q++)
{
if((a+0.0)/(b+0.0)<=(t[p]+0.0)/(t[q]+0.0))
if(max<t[p]*t[q])
{
max=t[p]*t[q];
rp=t[p];
rq=t[q];
}
}
}
printf("%d %d\n",rp,rq);
max=0;
}
return 0;
}
poj1411 枚举 算法复杂度还比较高的……
最新推荐文章于 2022-04-28 15:03:54 发布