1285C - Fadi and LCM
Ideas:
official:
Note: The author did not notice the least common multiple of two times before the game, only that x is a common multiple of a, b of
#include<bits/stdc++.h> #define ll long long using namespace std; ll gcd(ll a,ll b){ if(b==0)return a; return gcd(b,a%b); } int main(){ ll x,a,b,sq; ios::sync_with_stdio(false);cin.tie(0); cin>>x; sq=sqrt(x); for(ll i=sq;i;i--){ if(x/i*i==x&&gcd(i,x/i)==1){//i!=x/i cout<<i<<' '<<x/i<<endl; break; } } //if(x==1ll)cout<<1<<' '<<1<<endl; return 0; }