Source Code
#include <iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include <random>
#define ll long long

using namespace std; 


int main() {
	ll n, x, y,ans=0,i=0;
	cin >> n >> x >> y;
	while (true)
	{
		i += max(x,y);
		ans += (i / x);
		ans += (i / y);
		if (ans == n)
			break;
		ans = 0;
	}
	cout << i;
}
Copy
Hurry up OthmanMaher
GNU G++17
1099 ms
528 KB
Time Limit Exceeded