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

using namespace std;


#define  all(a)   a.begin(), a.end()
#define  endl  '\n'
#define  ll long long
#define  set(a) fixed << setprecision(a)

ll hurry(ll t, ll x, ll y)
{
    long double c;
    c = (long double)t / (x + y);
    return max(x*(t-floor(c * x)), y*floor(c * x));

}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    ll t, x, y;
    cin >> t >> x >> y;

    cout << min(hurry(t, x, y), hurry(t, y, x));
}
Copy
Hurry up tahahussein143
GNU G++17
1 ms
880 KB
Accepted