Codeforces Round #118 (Div. 1) A Mushroom Scientists (多元

题目链接:Codeforces Round #118 (Div. 1) A Mushroom Scientists

题意:提炼出来就是求f(x,y,z)=x^a*y^b*z^b,这个三元函数在(0<=x,y,z,x+y+z<=s)的区域内的最值。

思路:

更严格的还要证明在边界所取到的值比极值要小。

注意:%.10lf注意看题目的output

AC代码:

#include <stdio.h>int main(){int s;int a,b,c;double x,y,z,p;while(scanf("%d",&s)!=EOF){scanf("%d %d %d",&a,&b,&c);p=1.0*(a+b+c)/s;if(a+b+c==0){x=0,y=0,z=0;printf("%.10lf %.10lf %.10lf\n",x,y,z);continue;}x=a/p;y=b/p;z=c/p;printf("%.10lf %.10lf %.10lf\n",x,y,z);}return 0;}

,关于爱情简短的句子

Codeforces Round #118 (Div. 1) A Mushroom Scientists (多元

相关文章:

你感兴趣的文章:

标签云: