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() {
	int n, x, y,ans=0;
	cin >> n >> x >> y;
	int i=0;
	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
1100 ms
372 KB
Time Limit Exceeded