Source Code
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;

int n, x, y;
bool enough(ll x){
  if(x / ::x + x / y >= n)
    return 1;
  return 0;
}

int main(){
// #ifndef ONLINE_JUDGE
//   freopen("in.txt", "r", stdin);
// #endif
ios_base::sync_with_stdio(0);
cin.tie(0);
  
  cin >> n >> x >> y;
  ll l = 1, r = 2e18, ans = 0;
  while(l <= r){
    ll mid = (l + r) / 2;
    if(enough(mid)){
      ans = mid;
      r = mid - 1;
    }
    else
      l = mid + 1;
  }
  cout << ans;

  
 
 
  return 0;
}
Copy
Hurry up Ammar_Lahloh
GNU G++17
0 ms
904 KB
Accepted