Source Code
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long x,y,n,ans;
    cin >> n >> x >> y;

    if (x > y) {
        swap(x,y);
    }
    long long z =ceil(n/(double)y);
    long long w =(n-z);
    if (z*y != x*w) {
        z--;
        w++;
    }
    ans = max(z*y,x*w);
    cout << ans ;
}
Copy
Hurry up MOohamed_Mahfouz
GNU G++17
0 ms
388 KB
Wrong Answer