poj-2403-cup
题目描述
The 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.
输入
The input consists of several test cases. The first line of input contains an integer T, indicating the num of test cases. 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.
输出
For each test case, output the height of hot water on a single line. Please round it to six fractional digits.
样例输入
样例输出
提示
#include<stdio.h>
#include<math.h>
#define PI 3.14159265
int main()
{
int t;
double r,R,H,V,v0,h1;
double ans;
while(scanf("%d",&t)!=EOF)
{
while(t--)
{
scanf("%lf%lf%lf%lf",&r,&R,&H,&V);
if(r!=R)
{
h1=(R-r)/(H*r)-H; //补全的小圆锥A的高,用相似比算出来
v0=(PI*r*r*h1)/3; //小圆锥A的体积
ans=(H+h1)-(H+h1)*pow((((PI*r*r*(H+h1)/3)-V)/(PI*r*r*(H+h1)/3)),1.0/3); //热水倒入后的体积的高 可以用总的体积减去热血倒入后的体积形成的那个圆锥B与总的补起来后的大圆锥C用相似法比 得出小圆锥B的高 所求的高为大圆锥C高-小圆锥B的高
}
else
{
ans=V/(PI*(r*r));
}
if(ans>H) ans=H;
printf("%.6lf\n",ans);
}
}
return 0;
}
poj-2403-cup的更多相关文章
- poj 2403
http://poj.org/problem?id=2403 题意:就是给你m个单词,以及n段对话.每一个单词都有所对应的价值.求对话中的价值总和 题解:很简单,就是用单词和价值对应起来,然后再寻找就 ...
- Poj 2403 Hay Points(Map)
一.题目大意 实现一个工资计算系统.工资的计算规则是:首先,给定一些关键字和对应的价值,这个相对于字典.然后给出的是求职者的描述,如果这个描述中包含关键字则加上对应的价值,总得价值就是这个求职者的工资 ...
- POJ 2403 Hay Points
Hay Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5735 Accepted: 3695 Descri ...
- Poj 3117 World Cup
1.Link: http://poj.org/problem?id=3117 2.Content: World Cup Time Limit: 1000MS Memory Limit: 65536 ...
- Poj 1953 World Cup Noise之解题报告
World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16369 Accepted: 8095 ...
- poj - 1953 - World Cup Noise(dp)
题意:n位长的01序列(0 < n < 45),但不能出现连续的两个1,问序列有多少种. 题目链接:id=1953" target="_blank">h ...
- POJ 1953 World Cup Noise
World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14397 Accepted: 7129 ...
- poj 1953 World Cup Noise (dp)
World Cup Noise Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16774 Accepted: 8243 ...
- POJ 1953 World Cup Noise(递推)
https://vjudge.net/problem/POJ-1953 题意:输入一个n,这n位数只由0和1组成,并且不能两个1相邻.计算共有多少种排列方法. 思路:递推题. 首先a[1]=2,a[2 ...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
随机推荐
- javascript操作json总结
原文:http://www.cnblogs.com/worfdream/articles/1956449.html JSON(JavaScript Object Notation) 是一种轻量级的数据 ...
- Webfrom 生成流水号 组合查询 Repeater中单选与复选控件的使用 JS实战应用
Default.aspx 网页界面 <%@ Page Language="C#" AutoE ...
- Gengxin讲STL系列目录
引言:有人催我写关于STL的博客#(滑稽) STL嘛,昨晚有人一直逼问我STL名字的由来——STL = Standard Template Library,标准模板库,惠普实验室开发的一 ...
- 一台nginx服务器多域名配置 (转)
Nginx强大的正则表达式支持,可以使server_name的配置变得很灵活,如果你要做多用户博客,那么每个用户拥有自己的二级域名也就很容易实现了. 下面我就来说说server_name的使用吧: s ...
- typecho博客出404页面修改方法
适用于typecho博客版本为:0.9 (13.12.12) typecho博客,很多时候可能安装完毕,除了首页,其他页面都是404=.= 在匹配*.php的location区域修改为以下格式: lo ...
- 异常处理与调试4 - 零基础入门学习Delphi53
调试(Debug) 让编程改变世界 Change the world by program 调试(Debug) 在应用程序开发中检测.处理程序中的错误是一个非常重要的环节.在Delphi的集成开发环境 ...
- js加载优化三
Javascript性能优化之异步加载和执行 Author:小欧2013-09-17 随着科技的发展,如今的网站和五六年前相比,现在的人们对web的要求越来越高了,用户体验,交互效果,视觉效果等等都有 ...
- jQuery多版本的使用,同一文件多个版本引用
<html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8&quo ...
- STL中,迭代器的分类
五类迭代器如下: 1.输入迭代器:只读,一次传递 为输入迭代器预定义实现只有istream_iterator和istreambuf_iterator,用于从一个输入流istream中读取.一个输 ...
- poj 1077-Eight(八数码+逆向bfs打表)
The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've see ...