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

int main() {
	
	long long n,x,y;
	cin>>n>>x>>y;
	
	long long neededTime, l = 1,h= 1000000000000000000;
	while(l<=h){
		long long md = (l+h)/2;
		long long canSolve = md/x + md/y;
		if(canSolve >= n){
			neededTime = md;
			h = md - 1;
		}else{
			l = md + 1;
		}
	}
	
	cout<<neededTime;

	return 0;
}
Copy
Hurry up bnahmad15
GNU G++17
1 ms
776 KB
Accepted