Source Code
#include <bits/stdc++.h>

using namespace std;

int main()
{

    long long  n,x,y;
    cin>>n>>x>>y;

    long long  lo=0,hi=1e18;
    long long  ans=0;
    while(lo<=hi)
    {
        long long  mid =(lo+hi)>>1;

        if(mid/x+mid/y>= n)
        {
            ans=mid;
            hi=mid-1;
        }
        else
            lo=mid+1;
    }

    cout<<ans;

    return 0;
}
Copy
Hurry up Mohamedmaher
GNU G++17
4 ms
1.1 MB
Accepted