Codeforces Round #118 (Div. 1) A Mushroom Scientists (多元函数极值问题+拉格朗日乘数法)
来源:互联网 发布:php 扩展开发 编辑:程序博客网 时间:2024/05/21 07:57
题目链接: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;}
4 0
- Codeforces Round #118 (Div. 1) A Mushroom Scientists (多元函数极值问题+拉格朗日乘数法)
- Codeforces Round #118 (Div. 1) A Mushroom Scientists (多元函数极值问题+拉格朗日乘数法)
- CodeForces Round #118 - Mushroom Scientists
- 【水分配】codeforces 185B (#118 D)- Mushroom Scientists
- Mushroom Scientists(Codeforce)
- 多元函数求极值问题
- 多元函数求极值问题
- 多元函数求极值问题
- Codeforces Beta Round #99 (Div. 1) C Mushroom Gnomes - 2(单点查询)
- 拉格朗日乘数法解带约束的极值问题
- 拉格朗日乘数法求条件极值(最大熵)
- 【微积分】CodeForces 185B Mushroom Scientists
- codeforces 186D Mushroom Scientists 不等式
- Mushroom Scientists
- Codeforces Round #118 (Div. 1) A. Plant
- 多元函数的极值
- gcj Round 1A 2015 Mushroom Monster
- 多元函数的极值及条件极值
- 第五周项目四静态成员应用
- POJ 1062 昂贵的聘礼(DP)
- linux解压命令
- (R语言)概率分布
- Spark技术内幕:Shuffle的性能调优
- Codeforces Round #118 (Div. 1) A Mushroom Scientists (多元函数极值问题+拉格朗日乘数法)
- 第五周阅读项目4:常对象成员
- 第五周 阅读程序 (4)
- Cookie和Session
- 项目1-体验常指针函数
- (R语言)语句组、循环和条件操作
- php实现的web采集神器
- 第四周项目二 三角形 1初始版本
- 第五周阅读程序六