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. 使用STM32CubeMX生成RTC工程[秒中断]

    现在我们在之前的工程(http://www.cnblogs.com/libra13179/p/7170791.html)中修改 /** ******************************** ...

  2. DataSnap Server 客户端调用 异常

    No peer with the interface with guid {9BB0BE5C-9D9E-485E-803D-999645CE1B8F} has been registered.

  3. APP-9-文字识别-车牌识别

    1.获取Access Token APP-9.1-百度应用-文字识别 2.代码部分 <!DOCTYPE html> <html> <head> <meta c ...

  4. TypeScript语言学习笔记(1)

    基本类型 // 布尔型(Boolean) let isDone: boolean = false; // 数值型(Number) let decimal: number = 6; let hex: n ...

  5. Python使用xlwt模块 操作Excel文件

    导出Excel文件     1. 使用xlwt模块 import xlwt import xlwt    # 导入xlwt # 新建一个excel文件 file = xlwt.Workbook() # ...

  6. openwrt手动wifi设成client模式[笔记]

    说明:刚刷好的OPENWRT,默认是不带luci-web管理的,所以得手工SSH或TELNET上去改WIFI模式,以便通过WIFI连到现有的ROUTER去下载安装luci...: root@OpenW ...

  7. UNION 与 UNION ALL的区别

    UNION 操作符用于合并两个或多个 SELECT 语句的结果集. 请注意,列的数量.数据类型.顺序要保持一致!!! 结果集中的列名总是等于 UNION 中第一个 SELECT 语句中的列名. 例子: ...

  8. 吴裕雄 27-MySQL 元数据

    你可能想知道MySQL以下三种信息:查询结果信息: SELECT, UPDATE 或 DELETE语句影响的记录数.数据库和数据表的信息: 包含了数据库及数据表的结构信息.MySQL服务器信息: 包含 ...

  9. Python基础学习Day4 列表的使用方法、range 用法、in用法

    一.列表 1.1列表:python基础数据类型之一:其他语言也有列表的概念,js 数组,可索引 ,可切片,可加步长 1.2列表的索引,切片,切片+ 步长 结果: 注意:列表里元素的数据类型,就是它本身 ...

  10. 微服务之间的调用(Ribbon与Feign)

    来源:https://blog.csdn.net/jrn1012/article/details/77837658 使用Eureka作为服务注册中心,在服务启动后,各个微服务会将自己注册到Eureka ...