POJ3737:UmBasketella
来源:互联网 发布:自定义端口范围 编辑:程序博客网 时间:2024/05/22 12:11
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 contains several test cases. Eash case contains only one real numberS, representing the surface area of the cone. It is guaranteed that 1≤S≤10000.
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.
30
10.934.371.55给一个圆锥的表面积(包括底部)要求给出最大的体积、高和底面圆半径。v=1/3*PI*r^2*h;s=PI*r^2+2*PI*r*sqrt(r^2+h^2).易知为凸函数,三分r(0<r<sqrt(s/PI)(h=0)),将r代入s表达式中求出h表达式即为f().#include<cstdio>#include<cmath>#define PI acos(-1.0)#define eps 1e-8double s;double f(double x){return sqrt(pow((s-PI*x*x)/(PI*x),2)-x*x);}int main(){double r,l,mid1,mid2,v1,v2,v,h;while(scanf("%lf",&s)!=EOF){l=0;r=sqrt(s/PI);while(r-l>eps){mid1=(r+l)/2;mid2=(mid1+r)/2;h=f(mid1);v1=PI*mid1*mid1*h;h=f(mid2);v2=PI*mid2*mid2*h;if(v2>v1)l=mid1;elser=mid2;}v=v1/3;printf("%.2f\n%.2f\n%.2f\n",v,h,l);}return 0;}
- POJ3737:UmBasketella
- [POJ3737]UmBasketella
- poj3737 UmBasketella [三分]
- poj3737 UmBasketella(三分)
- [POJ3737]UmBasketella(三分法)
- [复习][poj3737]三分 UmBasketella
- POJ3737
- POJ3737
- UmBasketella
- UmBasketella
- UmBasketella
- POJ3737【数学】
- 3737 UmBasketella
- poj3737(三分搜索)
- pku 3737 UmBasketella
- POJ 3737 UmBasketella 三分
- poj 3737 UmBasketella
- POJ 3737 UmBasketella
- 01背包--苹果,背包问题
- 黑马程序员_多线程的线程间通信学习笔记
- XCode+Mac+MySQL版
- 计时器
- 在Ubuntu Server上源码安装OpenERP 8.0,并配置wsgi和nginx运行环境
- POJ3737:UmBasketella
- java SE 7规范(又名JDK 7)
- mybatis和iBATIS差异
- C++的坑真的多吗?
- HEVC术语
- MFC 手动生成SDI结构的方法
- 裘宗燕:C/C++ 语言中的表达式求值
- 在SQL 2008中如何设置自增列
- java个人学习笔记13(Object+内部类+局部内部类+匿名内部类)