Source Code
#include <iostream>
using namespace std;



int main()
{
    int qu, num1, num2, max, lcm, n = 0,t=0;

    cin >> qu >> num1 >> num2;

    max = (num1 > num2) ? num1 : num2;

    while (true)
    {
        if (max % num1 == 0 && max % num2 == 0)
        {
            lcm = max;
            break;
        }
        else
            max++;
    }
    n = max / num1 + max / num2;
    t = qu / n * max;
    qu -= qu / n;
    cout << t;


    return 0;
}
Copy
Hurry up OthmanMaher
GNU G++17
0 ms
384 KB
Wrong Answer