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

using namespace std;
typedef long long ll;
const int MAXN = 1e2 + 5;


int main()
{
    

 ll n,x,y;
 cin >> n >> x >> y;

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

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

 cout  << ans;

    
}
Copy
Hurry up DoeJohn
GNU G++17
2 ms
276 KB
Accepted