Click Here to go back to the homepage.

Sok Solution:


#include <bits/stdc++.h>

using namespace std;

int main(){
    
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    double a, b, c, d, e, f;
    cin >> d >> e >> f >> a >> b >> c;
    double ratio1 = d/a;
    double ratio2 = e/b;
    double ratio3 = f/c;
    double cocktailsMade = (ratio1 < ratio2 && ratio1 < ratio3) ? ratio1 : (ratio2 < ratio3) ? ratio2 : ratio3;
    cout << (d - a * cocktailsMade) << " " << (e - b * cocktailsMade) << " " << (f - c * cocktailsMade);
    return 0;
}