Source Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair

const int mod=1000000007;
int main(){
    ios_base::sync_with_stdio(0);
    ll n,x,y;
    cin>>n>>x>>y;
    ll ans=100000000000;
    ll l=1,h=10000000000;
    while(l<=h){
        ll md=(l+h)/2;
        ll have=md/x+md/y;
        if(have>=n){h=md-1;ans=min(ans,md);}
        else l=md+1;
    }
    cout<<ans<<endl;
    return 0;
}
Copy
Hurry up IDK
GNU G++17
0 ms
464 KB
Wrong Answer