codeforces 186D Mushroom Scientists 不等式

http://codeforces.com/blog/entry/4488 

还是直接看cf的题解吧

am-gm不等式。。

又学到了

#include 
#include 

using namespace std;

int main()
{
    double a,b,c,S;
    cin>>S;
    cin>>a>>b>>c;
    if(a+b+c!=0) printf("%.10lf %.10lf %.10lf",S*a/(a+b+c),S*b/(a+b+c),S*c/(a+b+c));
    else printf("0 0 0");
    return 0;
}


你可能感兴趣的:(Codeforces,数学)