UmBasketella

http://poj.org/problem?id=3737

Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 9489   Accepted: 3674

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

Source

 
 

三分模板题

 #include<cstdio>
#include<cmath>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 1000006
#define eps 1e-8
#define pi acos(-1.0)
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef unsigned long long ull; double s; double cal(double r){
double l=s/pi/r-r;
double h=sqrt(l*l-r*r);
double v=pi*r*r*h/3.0;
return v;
} int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
// std::ios::sync_with_stdio(false);
while(~scanf("%lf",&s)){
double L=,R=sqrt(s/2.0/pi),mid1,mid2;
while(R-L>eps){
mid1=L+(R-L)/;
mid2=R-(R-L)/;
if(cal(mid1)>=cal(mid2)){
R=mid2;
}
else{
L=mid1;
}
}
double l=s/pi/R-R;
double h=sqrt(l*l-R*R);
double v=pi*R*R*h/3.0;
printf("%.2f\n%.2f\n%.2f\n",v,h,R);
}
}

UmBasketella的更多相关文章

  1. poj3737 UmBasketella 真正的三分

    之前用二分写三分的板子...现在正式写一个三分,但是也不难,就是把区间分为三段就行了.求二次函数的峰值,每次取大的区间就行了. 题干: 最近几天,人们总是设计出多功能的新东西.例如,您不仅可以使用手机 ...

  2. POJ3737 UmBasketella

    嘟嘟嘟 一道三分入门题. 参考二分,三分就是每一次把区间分成三段,然后舍弃一段,不断缩小范围直到一个点. 一般用于求单峰函数的最值问题. 这道题发现V和r成一次函数的关系,因此三分r. 下面给出三分板 ...

  3. [SinGuLaRiTy] 分治题目复习

    [SInGuLaRiTy-1025] Copyrights (c) SinGuLaRiTy 2017. All Rights Reserved. [POJ 1905] 棍的膨胀 (Expanding ...

随机推荐

  1. Activity工作流学习(二)--Activity数据库

    23张表 ACT_RE_资源库流程规划表 act_re_deployment 部署信息表 act_re_model 流程设计模型部署表 act_re_procdef 流程定义数据表 ACT_RU_运行 ...

  2. svn2

    ubuntu下安装subversion客户端: sudo apt-get install subversion subversion-tools 详细请看 http://www.subversion. ...

  3. django 之manytomany

    https://www.cnblogs.com/changbaishan/p/8056762.html https://blog.csdn.net/hpu_yly_bj/article/details ...

  4. pycharm添加版本控制

  5. 使用dig或nslookup指定dns服务器查询域名解析

    一般来说linux下查询域名解析有两种选择,nslookup或者dig,而在使用上我觉得dig更加方便顺手.如果是在linux下的话,只要装上dnsutils这个包就可以使用dig命令, 安装bind ...

  6. php运行代码流程和性能优化方法

    ---恢复内容开始--- php文件->扫描->zd引擎去理解->opcodes->执行->输出 例子,用white随机循环20000数据进行性能测试,分别对比isset ...

  7. match()方法解析

    match()方法支持正则表达式的String对象的方法. 上篇我说了search()方法,也支持正则表达式的String对象,那么match()方法跟search()方法有什么不同呢?我们来看看. ...

  8. IDEA 中的一些概念变化

    IntelliJ系中的Project相当于Eclipse系中的workspace. IntelliJ系中的Module相当于Eclipse系中的Project. idea中只能配置一个maven,而且 ...

  9. GitHub中国区前100名到底是什么样的人?向大佬们学习。

    本文转自:码迷 http://www.mamicode.com/info-detail-1267434.html 本文根据Github公开API,抓取了地址显示China的用户,根据粉丝关注做了一个排 ...

  10. RTX二次开发SDK需要注意的地方

    1.如果是ASP.net二次开发调用的,线程池必须开发 Enable 32-bit Applications设置为true. 因为RTX的调用接口很多是32位的.否则会报一下错误 RootObj =  ...