Codeforces 1285C. Fadi and LCM Solution
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd Batch
///Islamic University,Bangladesh
#include <iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
{
long long int n,a,f,i,b,lcm,gcd;
cin>>n;
for(i=sqrt(n); i>=1; i--)
{
if(n%i==0)
{
gcd=__gcd(n/i,i);
lcm=(n/i)*i/gcd;
if(lcm==n)
{
cout<<i<<" "<<n/i<<endl;
f=1;
break;
}
if(f==1)
break;
}
if(f==1)
break;
}
}
}
No comments