HDU 5954 Do Not Pour Out
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define ms(arr,a) memset(arr,a,sizeof arr)
#define debug(x) cout<<"< "#x" = "<<x<<" >"<<endl
double eps=1e-;
const double pi=3.1415926536;
double d;
double V;
double longaxis,shortaxis;
double calcV(double w)
{
if(w>-eps&&w<eps)return ;
return (w-)*pi/w-(*(w-)*asin(-w)+sqrt(*w-w*w)*(-*w*w+*w-))//w;
}
bool ok(double w)
{
//debug(w);
//debug(calcV(w));
if(calcV(w)<V+eps)return true;
return false;
}
double solve(double l,double r)
{
double m;
while(l<r)
{
m=(l+r)/.;
if(ok(m))l=m+eps;
else r=m-eps;
}
return l;
}
double F(double x)
{
return *shortaxis/longaxis*(longaxis*longaxis*asin(x/longaxis)+sqrt(longaxis*longaxis-x*x)*x)/;
}
int main()
{
//freopen("Input.txt","r",stdin);
//freopen("Output.txt","w",stdout);
int T;scanf("%d",&T);
while(T--)
{
scanf("%lf",&d);
if(d>=)
{
printf("%.5f\n",pi*sqrt(d*d-*d+));
continue;
}
if(d==)
{
printf("0.00000\n");
continue;
}
V=d*pi;
//debug(V);
double w=solve(.,.);
//debug(w);
longaxis=sqrt(w*w+)/w;
shortaxis=;
double part=sqrt(w*w+);
printf("%.5f\n",F(longaxis)-F(longaxis-part));
}
//freopen("CON","w",stdout);
//system("start Output.txt");
}
HDU 5954 Do Not Pour Out的更多相关文章
- HDU 5954 - Do not pour out - [积分+二分][2016ACM/ICPC亚洲区沈阳站 Problem G]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5954 Problem DescriptionYou have got a cylindrical cu ...
- hdu 5954 -- Do not pour out(积分+二分)
题目链接 Problem Description You have got a cylindrical cup. Its bottom diameter is 2 units and its heig ...
- Do not pour out HDU - 5954 数学积分
题目:题目链接 思路:纯高等数学问题,不过不是很好积分,具体积分思路及过程参考大佬博客——https://blog.csdn.net/danliwoo/article/details/53002695 ...
- hdu5954 Do not pour out【积分】【二分】【待补.....】
2016沈阳区域赛http://acm.hdu.edu.cn/showproblem.php?pid=5954 Do not pour out Time Limit: 2000/1000 MS (Ja ...
- 2016ACM/ICPC亚洲区沈阳站-重现赛
C.Recursive sequence 求ans(x),ans(1)=a,ans(2)=b,ans(n)=ans(n-2)*2+ans(n-1)+n^4 如果直接就去解...很难,毕竟不是那种可以直 ...
- HDU 2389 Rain on your Parade / HUST 1164 4 Rain on your Parade(二分图的最大匹配)
HDU 2389 Rain on your Parade / HUST 1164 4 Rain on your Parade(二分图的最大匹配) Description You're giving a ...
- HDU 1495 非常可乐(数论,BFS)
非常可乐 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- HDU 1495 非常可乐 bfs 难度:1
http://acm.hdu.edu.cn/showproblem.php?pid=1495 第三个杯子的盛水量可由前两个杯子得到,而前两个杯子状态总数在100*100以内,穷举可实现 #includ ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
随机推荐
- Java 程序该怎么优化?(工具篇)
程序员:为什么程序总是那么慢?时间都花到哪里去了? 面试官:若你写的 Java 程序,出现了性能问题,该怎么去排查呢? 工欲善其事必先利其器,为你呈上一箩筐性能优化工具,必有一款满足你,废话不多说,直 ...
- 拿万元月薪必备的书单,学JAVA的程序员必看的5本书!
点击蓝色"程序员黄小斜"关注我哟 加个"星标",每天带你读好书! 文/黄小斜 转载请注明出处 每一年的年初都是买书学习热情高涨的时候,虽然不知道你们是让这些书吃 ...
- 1046 Shortest Distance (20分)
The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed t ...
- 如何连接到Oracle数据库?
如何连接到Oracle数据库? 使用SQL * Plus连接Oracle数据库服务器 SQL * Plus是交互式查询工具,我们在安装Oracle数据库服务器或客户端时会自动安装.SQL * Pl ...
- php __DIR__ 解释下
__DIR__, php5.3 才增加的这个魔术常量,表示当前文件所在的目录地址. php5.3之前用dirname(__FILE__);表示__DIR__; __FILE__这个表示当前文件的路径.
- usdt钱包对接,usdt 对接交易平台,usdtapi,以太坊对接,以太坊代币对接
usdt钱包对接,usdt 对接交易平台,usdtapi,以太坊对接,以太坊代币对接 自动充提币接口开发. 可对接:商城系统,游戏APP,交易平台,网站,各类APP -实现自动充提,查询,上链等功能接 ...
- SpringMVC(六):分层整合SSM
环境搭建 版本: MySQL 8 SpringMVC+Spring+Mybatis C3P0连接池 数据库建表 CREATE DATABASE `ssmbuild`; `ssmbuild` DROP ...
- System.out.println()的真实含义
每一个人的Java学习之路上恐怕都是用以下代码开始的吧? public class Test { public static void main(String[] args) { System.out ...
- split(resource,limit) 中limit 的含义
limit 参数控制模式应用的次数,因此影响结果数组的长度.如果该限制 n 大于 0,则模式将被最多应用 n - 1 次,数组的长度将不会大于 n,而且数组的最后项将包含超出最后匹配的定界符的所有输入 ...
- split(" {1,}") 含义
将字符串按照括号内的内容分割成字符数组 这里括号内是正则表达式,X{m,n}代表X至少重复m次,至多重复n次 这里x为空格,至少重复1次,就是将字符串以一个或多个空格分割 如"1 2 ab ...