Source Code
// {In the Name of Allah, the Most Beneficent, the Most Merciful }
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
#define mp make_pair
#define pb push_back
#define pf push_front
#define IOS ios_base::sync_with_stdio(0);cin.tie(NULL);
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
#define el "\n"


int main()
{
/**/IOS/**/
long long n , x , y ;
cin>>n >>x >> y;


long long l , r , ans =0 ;
r=n*min(x,y);
l=0;

while(l<=r)
{
	
	long long m = (l+r)/2;
	
	if((m/x+m/y)==n)
	{
		ans = m ;
		break;
	}
	else if ((m/x+m/y)>n)
	{
		r=m-1;
	}
	else
	l=m+1;

	
}

if(ans)
cout<<ans;
else
cout<<n;
}//main 
Copy
Hurry up aram
GNU G++17
0 ms
808 KB
Wrong Answer