HDU 2289 Cup
Cup
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 7077 Accepted Submission(s): 2177
WHU ACM Team has a big cup, with which every member drinks water. Now,
we know the volume of the water in the cup, can you tell us it height?
The radius of the cup's top and bottom circle is known, the cup's height is also known.
Each
test case is on a single line, and it consists of four floating point
numbers: r, R, H, V, representing the bottom radius, the top radius, the
height and the volume of the hot water.
Technical Specification
1. T ≤ 20.
2. 1 ≤ r, R, H ≤ 100; 0 ≤ V ≤ 1000,000,000.
3. r ≤ R.
4. r, R, H, V are separated by ONE whitespace.
5. There is NO empty line between two neighboring cases.
100 100 100 3141562
#include <cstdio>
#include <cmath> const double PI = acos(-1.0);
int T;
double r,R,H,V; int main()
{
scanf("%d", &T);
while(T--){
scanf("%lf%lf%lf%lf", &r, &R, &H, &V);
double low = , high = H;
double mid;
while(high-low>1e-){
mid = (low+high)/;
double mid_r = mid/H*(R-r)+r;
double mid_v = PI/*mid*(r*r+r*mid_r+mid_r*mid_r);
if(mid_v<V)
low = mid+1e-;
else
high = mid-1e-;
}
mid = (low+high)/;
printf("%.6f\n", mid);
}
return ;
}
HDU 2289 Cup的更多相关文章
- HDU 2289 Cup【高精度,二分】
Cup Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- hdu 2289 Cup (二分法)
http://acm.hdu.edu.cn/showproblem.php?pid=2289 二分法解题. 这个题很恶心...一开始测试样例都不能过,这个π一开始取3.1415926结果是99.999 ...
- HDU 2289 CUP 二分
Cup Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- HDU 2289 Cup(可以二分法,但是除了它的一半?)
这道题目.运营商做数学题?算上两个子主题做?顶多算一个水主要议题... 首先,没有实际的二分法,但是,我们发现了一个新的解决方案,以取代二分法. 若果按照i从0,每次添加0.00000001我一直枚举 ...
- HDU 2289 Cup【二分】
<题目链接> 题目大意: 一个圆台型的杯子,它的上底半径和下底半径已经给出,并且给出它的高度,问你,体积为V的水倒入这个杯子中,高度为多少. 解题分析: 就是简单的二分答案,二分枚举杯中水 ...
- 二分搜索 HDOJ 2289 Cup
题目传送门 /* 二分搜索:枚举高度,计算体积与给出的比较. */ #include <cstdio> #include <algorithm> #include <cs ...
- Cup HDU - 2289
题目传送门:https://vjudge.net/problem/HDU-2289 题意:有一个上口小于底部的圆台形水杯,告诉我们水的体积求水高度. 思路:利用高中数学知识求rr然后二分求h,具体化简 ...
- hdu 2289 要二分的杯子
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2289 大意是 一个Cup,圆台形,给你它的顶部圆的半径,底部圆的半径,杯子的高度,和此时里面装的水的体 ...
- Hdoj 2289.Cup 题解
Problem Description The WHU ACM Team has a big cup, with which every member drinks water. Now, we kn ...
随机推荐
- SQL重复记录查询(转载)
1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select * from people ) 例二: select * from testtable where ...
- JS 实现取整(二)
1.直接丢弃小数部分,保留整数部分 a:parseInt(1.5555) b: 0|1.5555 2.向上取整 a: Math.ceil(1.5555) b: (1.5555+0.5).toFixed ...
- Bootstrap 内核引用(一)
方法一: Bootstrap CDN推荐 本站实例采用的是百度的静态资源库(http://cdn.code.baidu.com/)上的Bootstrap资源. 百度的静态资源库的 CDN 服务,访问速 ...
- aaaa
http://www.host.com http://www.host.com http://sz.weixun.com/scenery/details-3.htm http://sz.weixun. ...
- android/IOS各平台分享链接/跳转链接配置说明(备用)
Android: [Java] 纯文本查看 复制代码 ? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 微信/朋友圈 //设置 ...
- (转)inux Read系统调用
转载网址:http://my.oschina.net/haomcu/blog/468656 1. 什么是系统调用 2. read系统调用在内核空间的处理层次模型 3. 相关的内核数据结构 4. rea ...
- Elasticsearch升级至1.x后API的变化-三
请支持原创:http://www.cnblogs.com/donlianli/p/3841762.html 1.索引格式 1.x之前的版本,被索引的文档type会同时出现在url和传输的数据格式中 ...
- js检测浏览器版本代码,兼容ie11
原文:http://blog.csdn.net/tenkin/article/details/11640165 <script type="text/javascript"& ...
- Ubuntu 12.04安装字体
http://www.2cto.com/os/201210/160645.html 安装方法,终端输入: $ sudo thunar /usr/share/fonts/truetype 待ture ...
- SPRING IN ACTION 第4版笔记-第九章Securing web applications-001-SpringSecurity简介(DelegatingFilterProxy、AbstractSecurityWebApplicationInitializer、WebSecurityConfigurerAdapter、@EnableWebSecurity、@EnableWebMvcS)
一.SpringSecurity的模块 At the least, you’ll want to include the Core and Configuration modules in your ...