1e-8 WA了,1e-10水过
#include<iostream>
#include<cmath>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<iterator>
#include<queue>
#include<ctime>
#include<bitset>
#define eps 1e-6
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
//#define ll __int64
#define ll long long
#define lson l,m,(rt<<1)
#define rson m+1,r,(rt<<1)|1
#define M 1000000007
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int main()
{
int a,b;
while(~scanf("%d%d",&a,&b))
{
double ans=1000000;
double tar=a*1.0/b;
int na,nb;
for(int i=1;i<=32767;i++)
{
double u=i*1.0/b*1.0*a;
int ta=int(u);
int tta=int(u+1);
if(fabs(ta*1.0/i-tar)<ans&&fabs(ta*1.0/i-tar)>=1e-10)
{
ans=fabs(ta*1.0/i-tar);
na=ta;
nb=i;
}
if(fabs(tta*1.0/i-tar)<ans&&fabs(ta*1.0/i-tar)>=1e-10)
{
ans=fabs(tta*1.0/i-tar);
na=tta;
nb=i;
}
}
printf("%d %d\n",na,nb);
}
return 0;
}