#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的更多相关文章

  1. 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 ...

  2. hdu 5954 -- Do not pour out(积分+二分)

    题目链接 Problem Description You have got a cylindrical cup. Its bottom diameter is 2 units and its heig ...

  3. Do not pour out HDU - 5954 数学积分

    题目:题目链接 思路:纯高等数学问题,不过不是很好积分,具体积分思路及过程参考大佬博客——https://blog.csdn.net/danliwoo/article/details/53002695 ...

  4. 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 ...

  5. 2016ACM/ICPC亚洲区沈阳站-重现赛

    C.Recursive sequence 求ans(x),ans(1)=a,ans(2)=b,ans(n)=ans(n-2)*2+ans(n-1)+n^4 如果直接就去解...很难,毕竟不是那种可以直 ...

  6. 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 ...

  7. HDU 1495 非常可乐(数论,BFS)

    非常可乐 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  8. HDU 1495 非常可乐 bfs 难度:1

    http://acm.hdu.edu.cn/showproblem.php?pid=1495 第三个杯子的盛水量可由前两个杯子得到,而前两个杯子状态总数在100*100以内,穷举可实现 #includ ...

  9. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

随机推荐

  1. H - Bone Collector

    H - Bone Collector Many years ago , in Teddy's hometown there was a man who was called "Bone Co ...

  2. 1068 Find More Coins (30分)(dp)

    Eva loves to collect coins from all over the universe, including some other planets like Mars. One d ...

  3. Ring 笔记 - 核心概念

    Ring 是一个在 Clojure 中的对于 HTTP 的抽象,是构建 Web 应用的底层接口和库,类似于 Java 中的 Servlet 核心概念 Handler Handler 是一个定义web应 ...

  4. .NET Core 3.1 的REST 和gRPC 性能测试

    看到越南小哥 的github 上的Evaluating Performance of REST vs. gRPC , 使用的是.NET Core 3.0 , 今天我把它升级到.NET Core 3.1 ...

  5. Mysql数据库错误代码大全

                                                    Mysql数据库错误代码大全 出现较多的一些网页代码提示的意思: 1016错误:文件无法打开,使用后台修 ...

  6. shell使用特殊变量

                                                                 shell使用特殊变量 3.1问题 本例要求编写一个脚本/root/myuse ...

  7. IIC驱动学习笔记,简单的TSC2007的IIC驱动编写,测试

    IIC驱动学习笔记,简单的TSC2007的IIC驱动编写,测试 目的不是为了编写TSC2007驱动,是为了学习IIC驱动的编写,读一下TSC2007的ADC数据进行练习,, Linux主机驱动和外设驱 ...

  8. java中查询某个类已经创建了多少个对象了

    这个代码主要是使用类的静态字段和构造函数,可以跟踪某个类所创建对象的个数.请写一个类,在任何时候都可以向它查询“你已经创建了多少个对象? 主要是在构造函数中用到了静态数据,进行显示已经构造了多少个类对 ...

  9. Linux 磁盘管理篇,设备文件

    IDE硬盘                /dev/hd[a-d] SCSI/SATA/USB硬盘        /dev/sd[a-p] U盘                /dev/sd[a-p] ...

  10. c++类模板之分文件编写问题及解决

    我们在实际项目中一般习惯头文件(.h)和源文件(.cpp)分开写,这样做的好处良多,但是如果遇到了类模板,这样可能会有一点儿问题. 我们通过一个例子来看: person.h: #pragma once ...