#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. E - River Hopscotch POJ - 3258(二分)

    E - River Hopscotch POJ - 3258 Every year the cows hold an event featuring a peculiar version of hop ...

  2. Shiro 笔记

    功能 认证 授权 加密 session 管理 认证 Subject 是一个与系统交互的实体,可以是人,也可以是其他等 调用 SecurityUtils.getSubject()返回当前Subject, ...

  3. 一天学一个Linux命令:第二天 cd pwd

    文章更新于:2020-03-08 注:本文参照 man pwd 手册,并给出使用样例. 文章目录 一.命令之 `cd` 和 `pwd` 1.命令介绍 2.语法格式 3.使用样例 4.pwd 参数 5. ...

  4. MySQL InnoDB存储引擎体系架构 —— 索引高级

    转载地址:https://mp.weixin.qq.com/s/HNnzAgUtBoDhhJpsA0fjKQ 世界上只两件东西能震撼人们的心灵:一件是我们心中崇高的道德标准:另一件是我们头顶上灿烂的星 ...

  5. AJ整理问题之:NSTimer准确吗?

    NSTimer准确吗? 问题:NSTimer准确吗?如果不准确,怎么办? NSTimer的工作原理:假设timer每隔一段时间执行一次事件,很均匀的(例如每隔多少秒),假设在某一时刻cpu在做疯狂的大 ...

  6. 基于linux或windows的c/s的循环服务器求一元二次方程的根

    在linux和windows上实现 c/s模式 socket循环服务器求解一元二次方程的根 ax^2+bx+c=0 根据上式,客户端发送a,b,c给服务器,返回求解的根 暂未考虑非法数据等问题 lin ...

  7. N皇后问题 回溯非递归算法 C++实现2

    运行结果 代码如下 #include <bits/stdc++.h> using namespace std; ; const char *LINE32 = "--------- ...

  8. Python基础:按位异或 ^ ,按位或 | ,按位与 &

    前言文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行获取http: ...

  9. K - Downgrade Gym - 101775K

    题目大意:一天不玩相当于A-B中将A转换为经验值,B舍弃掉,然后A=1,在通过升级所需要的经验值来判断可以升几级 题目连接:https://codeforces.com/gym/101775/prob ...

  10. python基础--str.split

    string = 'This +is -a /string' process = string.split('-') process1 = string.split('-')[-1]#-1和-2可能存 ...