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

using namespace std;

int main()
{
    long long x,y,n,ans=0;
    cin >> n >> x >> y;
    long long l=1,r=1e9,mid;
    while (l<=r) {
        mid=(l+r)/2;
        if ((mid/x+mid/y) >= n) {
            ans = mid;
            r=mid-1;
        }
        else {
            l=mid+1;
        }
    }
    cout << ans << endl;
}
Copy
Hurry up MOohamed_Mahfouz
GNU G++17
0 ms
412 KB
Wrong Answer