sicily 1793. Numbers

#include<iostream>
#include
<cmath>
using namespace std;
int gcd(int a,int b)
{
int r;
while(b>0)
{
r
=a%b;
a
=b;b=r;
}
return a;
}
int main()
{
int a,b,c;
while(cin>>a>>b&&a)
{
c
=b/a;
for(int i=sqrt(double(c));i>=1;--i)
if(c%i==0&&gcd(c/i,i)==1)
{
cout
<<a*(c/i-i)<<" "<<a*i<<" "<<a*c/i<<endl;
break;
}
}
return 0;
}

  

posted on 2011-07-14 19:22  sysu_mjc  阅读(133)  评论(0编辑  收藏  举报

导航