POJ 3737 UmBasketella
来源:互联网 发布:lc32es62数据 编辑:程序博客网 时间:2024/05/19 05:03
Description
In recent days, people always design new things with multifunction. For instance, you can not only use cell phone to call your friends, but you can also use your cell phone take photographs or listen to MP3. Another example is the combination between watch and television. These kinds of multifunction items can always improve people's daily life and are extremely favored by users.
The company Mr. Umbrella invented a new kind umbrella "UmBasketella" for people in Rainbow city recently and its idea also comes from such multifunction--the combination of umbrella and daily necessities. This kind of umbrella can be used as a basket and you can put something you want to carry in it. Since Rainbow city rains very often, such innovative usage is successful and "UmBasketella" sells very well. Unfortunately, the original "UmBasketella" do not have an automatic volume control technology so that it is easily damaged when users try to put too many things in it. To solve this problem, you are needed to design an "UmBasketella" with maximum volume. Suppose that "UmBasketella" is a cone-shape container and its surface area (include the bottom) is known, could you find the maximum value of the cone?
Input
Input contains several test cases. Eash case contains only one real number S, representing the surface area of the cone. It is guaranteed that 1≤S≤10000.
Output
For each test case, output should contain three lines.
The first line should have a real number representing the maximum volume of the cone.
Output the height of the cone on the second line and the radius of the bottom area of the cone on the third line.
All real numbers should rounded to 0.01.
Sample Input
30
Sample Output
10.934.371.55
题意:
给出椎体的表面积,求最大体积和此时的高和底面半径。
题解:
第1道3分题,推出公式会发现是单峰曲线,裸的3分。
代码:
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>const double eps=10e-6;const double pi=acos(-1.0);using namespace std;double s;double cal(double r){ double R = s/(pi*r)-r; double h = sqrt(R*R-r*r); return h*pi*r*r/3;}int main(){ double left,right,mid1,v,v1,v2,mid2,r,h; while(~scanf("%lf",&s)) { left=0,right=s/pi; while(left+eps<right) { mid1=left+(right-left)/3; mid2=right-(right-left)/3; v1=cal(mid1); v2=cal(mid2); if(v1<v2) left=mid1; else right=mid2; } r=left; double R = s/(pi*r)-r; h=sqrt(R*R-r*r); v= h*pi*r*r/3; printf("%.2f\n%.2f\n%.2f\n",v,h,r); } return 0;}
- POJ 3737 UmBasketella 三分
- poj 3737 UmBasketella
- POJ 3737 UmBasketella
- poj 3737 UmBasketella 三分
- POJ 3737 UmBasketella.
- POJ 3737 UmBasketella
- POJ 3737 UmBasketella
- [POJ 3737]UmBasketella(三分)
- day5 POJ 3737 UmBasketella
- poj-3737(UmBasketella)
- POJ 3737 UmBasketella
- [POJ 3737][三分]UmBasketella
- POJ 3737 UmBasketella(三分)
- poj 3737 UmBasketella(三分+求导)
- POJ 3737 UmBasketella (数学)
- POJ 3737 UmBasketella(三分)
- POJ - 3737 - UmBasketella(三分)
- POJ 3737 UmBasketella 三分搜索
- 23种设计模式之十二(结构型模式)Proxy模式
- javabean、枚举
- cf_290(div2)A,B,C
- Oracle OCP笔记(13)表空间和数据文件
- oracle11g卸载出错 无法删除文件,文件正在使用中
- POJ 3737 UmBasketella
- poj2778--DNA Sequence(AC自动机+矩阵优化)
- js 小数取整的函数
- 窗体的扩展样式GWL_EXSTYLE: 用于SetWindowLong
- 开始编辑textView或者textField时向上推动self.view
- World Wind Java开发之十一——加载热点信息(仿Google Earth)
- 编程之美-分层遍历二叉树
- JSOUP抓取网页内容
- chan editor 轻量级的带语法高亮的代码编辑器