POJ 3737 UmBasketella 三分搜索
来源:互联网 发布:鉴于每次avmoo换域名 编辑:程序博客网 时间:2024/05/18 17:27
UmBasketella
Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %lld & %llu
Submit
Status
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.93
4.37
1.55
三分搜索
#include<iostream>#include<stdio.h>#include<cstring>#include<vector>#include<math.h>#include<sstream>#include<set>#include<map>#include<iomanip>#include<algorithm>using namespace std;const double pi = acos(-1.0);const double MIN=0.00001;double S;double F(double r){ double l=(S-pi*r*r)/pi/r; double h=sqrt(l*l-r*r); double v=h/3*pi*r*r; return v;}int main(){ cout<<fixed<<setprecision(2); while (cin>>S) { double left=0;double right=sqrt(S/2/pi)+MIN; double mid,midd; while (right-left>MIN) { mid=(left+right)/2; midd=(mid+right)/2; if (F(mid)>F(midd)) right=midd-MIN; else left=mid+MIN; } double R=(left+right)/2; double V=F(R); double h=V*3/pi/R/R; cout<<V<<endl<<h<<endl<<R<<endl; } 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(三分)
- 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
- 二、进程管理
- 注册asp.net 4.0 到iis
- redis事务
- adb devices出现no permissions
- python2.X在linux上的安装
- POJ 3737 UmBasketella 三分搜索
- poj1061青蛙的约会(exgcd拓展欧几里得)
- 女程序员做了个梦,众网友的神回复
- MFC中的DC,CDC和HDC
- Linux上搭建Jenkins
- 快速求素数个数
- LA 4287 Proving Equivalences(强连通分量缩点)
- 网站安全认证系统的设计变迁
- Spring事务管理(6)-执行目标方法