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)


int arr[1000];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);



    long double x, y, c, a, v, n;
    long long t;
    cin >> t >> x >> y;
    c = t / (x + y);
    a = floor(c * x);
    v = max(x*(t-a), y*a);
    a = ceil(c * x);
    n = max(x*(t-a), y*a);
    if(n < v)
        cout << (ll)n;
    else cout << (ll)v;
}
Copy
Hurry up tahahussein143
GNU G++17
0 ms
752 KB
Accepted