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. ...
随机推荐
- 1061 Dating (20分)
Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...
- 1024 Palindromic Number (25 分)
A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...
- WinForm中DataGridView复制选中单元格内容解决方案
WinForm中DataGridView鼠标选中单元格内容复制方案 1.CTR+C快捷键复制 前提:该控件ClipboardCopyMode属性设置值非Disable: 2.鼠标框选,自定义代码实现复 ...
- pinpoint配置使用
一.下载pinpoint包 从https://github.com/naver/pinpoint/releases 下载 pinpoint-agent.tar.gz pinpoint-collecto ...
- DALI 48V驱动
DALI-CC-30W-48V技术手册 产品名称:DALI-CC-30W-48V 支持协议:IEC 62386-101:2018,IEC 62386-102:2018,IEC 62386-207:20 ...
- 【数据库】MySQL数据库(五)
一.DCL语句 1.添加权限: '; 注:sakili为数据库名,z1为新创建的数据库用户,123为密码 数据库添加权限 2.权限收回: revoke insert on sakila.* from ...
- excel完成数据库数据的批量插入
业务场景: 开发过程中往往会遇到这样情况就是产品直接给我们一堆数据,让咱们直接导入到后台数据库中,这时候咱们只需要在excel表中进行直接操作即可,如图所示(以河北省的编号为例): 而对应的数据表为: ...
- PHP 5.6连接MySQL 8.0版本遇到的坑
一.数据库失败Warning: mysqli_connect(): The server requested authentication method unknown to t... <?ph ...
- 多线程设置flag标志位实现同步
信号灯解决同步问题 我尽量注释了代码,可以很容易理解了. package Thread; /** * 信号灯 * 借助标志位 */ public class FlagThread { public s ...
- .Net Core MVC 基于Cookie进行用户认证
在打代码之前先说一下思路. 登录的的时候服务端生成加密的字符串(用户名.id.当前时间)并且存入客户端cookie中,服务端的缓存中.对客户端的每次请求进行拦截,解密保存在cookie中的加密字符串. ...