当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3559:Trigonometric optimization

Special Judge 特殊评判
题目描述

Many problems arising in practical applications may be stated as optimization problems. Usually it is necessary to maximize or minimize so called criterion function taking into account some constraints.

Let’s consider a trigonometric optimization problem. It is necessary to maximize or to minimize criterion function F1(x) + F2(y) + F3(z) with constraint x + y + z = S, where x, y, z – variables, S – parameter, x, y, z, S – natural numbers excluding zero.  Each of the functions F1, F2 and F3 is a trigonometric function sin or cos.

You need to write a program which solves the trigonometric optimization problem.

输入解释

The input contains 5 lines. The first line describes function F1 and contains either sin or cos. The second and the third lines describe functions F2 and F3 respectively and have the same format as the first line. Next, the fourth line contains either min or max. If the line contains min than it is necessary to minimize criterion function, otherwise it is necessary to maximize criterion function. Finally, the fifth line contains parameter S value (3 ≤ S1 000 000).

输出解释

The only line of the output contains one real number – the found value of the criterion function, described in the input file. Absolute error of your answer must not exceed 10−10.

输入样例
sin
cos
sin
max
10
输出样例
2.7787651403
提示

Beware that GNU compilers for C and C++ provide relatively slow trigonometric functions.

来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3559

最后修改于 2020-10-29T07:04:32+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000 65536