Source Code
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <list>


using namespace std;


long long gcd(long long int a, long long int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

long long lcm(long long a, long long b)
{
    return (a / gcd(a, b)) * b;
}


int main()
{
    long long n,x,y;
    cin>>n>>x>>y;
    long double q= lcm(x,y), w=(q/y)+(q/x), e=n/w;
    cout<<fixed<<setprecision(0)<<ceil(e*q)<<endl;

}
Copy
Hurry up Abbro
GNU G++17
1 ms
616 KB
Wrong Answer