Skip to content

Instantly share code, notes, and snippets.

@Se7soz
Created January 2, 2017 13:49
Show Gist options
  • Save Se7soz/aed46d729243ec37d7d5ca4384630e54 to your computer and use it in GitHub Desktop.
Save Se7soz/aed46d729243ec37d7d5ca4384630e54 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;
int main(){
int s, a, b, c;
cin >> s >> a >> b >> c;
if((a+b+c) == 0) {
printf("0 0 0\n");
return 0;
}
double x = (double)s*a/(a+b+c);
double y = (double)s*b/(a+b+c);
double z = (double)s*c/(a+b+c);
printf("%.10lf %.10lf %.10lf\n", x, y, z);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment