186D - Mushroom Scientists - CodeForces Solution


math number theory probabilities *1800

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>
using namespace std; 

int main() {
    int s, a, b, c; cin >> s >> a >> b >> c; 

    if(a + b + c == 0) {
        cout << 0 << ' ' << 0 << ' ' << 0 << '\n'; 
        return 0;
    }

    double frac = (double) s / (double)(a + b + c); 
    double x = frac * (double) a; 
    double y = frac * (double) b; 
    double z = frac * (double) c; 

    cout << setprecision(20) << x << " " <<  y << " " << z << '\n'; 
}


Comments

Submit
0 Comments
More Questions

1589C - Two Arrays
1510K - King's Task
126B - Password
462A - Appleman and Easy Task
839C - Journey
622A - Infinite Sequence
659C - Tanya and Toys
1266A - Competitive Programmer
234C - Weather
1332C - K-Complete Word
525C - Ilya and Sticks
1555C - Coin Rows
1324C - Frog Jumps
715A - Plus and Square Root
774D - Lie or Truth
1186D - Vus the Cossack and Numbers
505B - Mr Kitayuta's Colorful Graph
1324D - Pair of Topics
157B - Trace
34C - Page Numbers
279A - Point on Spiral
1294D - MEX maximizing
447A - DZY Loves Hash
23B - Party
63D - Dividing Island
1203E - Boxers
1547F - Array Stabilization (GCD version)
358A - Dima and Continuous Line
1385C - Make It Good
651A - Joysticks