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

int main(){
  long long n,a,b;
  cin>>n>>a>>b;
  int e = 0, s = n*min(a,b);
  while(e<s){
    long long mid = (s+e)/2;
    if(mid/a+mid/b>=n){
      s = mid;
    }
    else{
      e = mid+1;
    }
  }
  cout<<e<<endl;
}
Copy
Hurry up Duukh
GNU G++17
0 ms
512 KB
Wrong Answer