Codeforces Round #613 (Div. 2) C. Fadi and LCM

C. Fadi and LCM

传送门

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll x;
  cin>>x;
  ll ans = x;
  for(ll i=1;i*i<=x;i++)
  {
    if(x%i==0)
    {
      ll a=i,b=x/i;
      if(__gcd(a,b)==1)
      {
        ans=min(ans,b);
      }
    }
  }
  cout<<ans<<' ' <<x/ans<<endl;
}

发布了289 篇原创文章 · 获赞 112 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/king9666/article/details/103948967