BestCoder Round #12 War(计算几何)
War
Time Limit: 8000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 81 Accepted Submission(s): 23
Special Judge
them. The occurrence of a war have a certain probability.
We calculate the probability as follow steps.
1. VC=volume of insection manor of A and B.
2. VU=volume of union manor of A and B.
3. probability=VC/VU
[Technical Specification]
0< R,HR,HZ<=100
1 1 1
2 1 1
0.666667
0.187500
pid=5052" target="_blank">5052
我们就分类讨论。r,和hr的大小。
然后在讨论下圆柱体有没有穿出球体。即sqrt(r*r-hr*hr)和r的大小。
对于一部分的球体的体积用用定积分.积出来为PI*r*r*z-PI*z*z*z/3|上下限。
#include<algorithm>
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<math.h>
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=100010;
const double PI=acos(-1.0);
const double eps=1e-8;
typedef long long ll; int main()
{
double r,hr,hz,vc,vu,d,a,b,hh; while(~scanf("%lf%lf%lf",&r,&hr,&hz))
{
if(hr<r)
{
d=sqrt(r*r-hr*hr);
if(hz<=d)
vc=2*PI*hr*hr*hz;
else
{
hh=min(hz,r);
a=PI*r*r*hh-PI*hh*hh*hh/3;
b=PI*r*r*d-PI*d*d*d/3;
vc=2*(PI*hr*hr*d+a-b);
}
}
else
{
if(hz<=r)
vc=2*(PI*r*r*hz-PI*hz*hz*hz/3);
else
vc=4*PI*r*r*r/3;
}
vu=4*PI*r*r*r/3+PI*hr*hr*hz*2-vc;
//printf("%lf %lf\n",vc,vu);
printf("%.6lf\n",vc/vu);
}
return 0;
}
BestCoder Round #12 War(计算几何)的更多相关文章
- bestcoder Round #7 前三题题解
BestCoder Round #7 Start Time : 2014-08-31 19:00:00 End Time : 2014-08-31 21:00:00Contest Type : ...
- BestCoder Round #14
Harry And Physical Teacher Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- BestCoder Round #11 (Div. 2) 题解
HDOJ5054 Alice and Bob Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...
- 判素数+找规律 BestCoder Round #51 (div.2) 1001 Zball in Tina Town
题目传送门 /* 题意: 求(n-1)! mod n 数论:没啥意思,打个表能发现规律,但坑点是4时要特判! */ /***************************************** ...
- 简单几何(水)BestCoder Round #50 (div.2) 1002 Run
题目传送门 /* 好吧,我不是地球人,这题只要判断正方形就行了,正三角形和正五边形和正六边形都不可能(点是整数). 但是,如果不是整数,那么该怎么做呢?是否就此开启计算几何专题了呢 */ /***** ...
- HDU 5228 ZCC loves straight flush( BestCoder Round #41)
题目链接:pid=5228">ZCC loves straight flush pid=5228">题面: pid=5228"> ZCC loves s ...
- BestCoder Round #89 02单调队列优化dp
1.BestCoder Round #89 2.总结:4个题,只能做A.B,全都靠hack上分.. 01 HDU 5944 水 1.题意:一个字符串,求有多少组字符y,r,x的下标能组成等比数列 ...
- BestCoder Round #90 //div all 大混战 一题滚粗 阶梯博弈,树状数组,高斯消元
BestCoder Round #90 本次至少暴露出三个知识点爆炸.... A. zz题 按题意copy Init函数 然后统计就ok B. 博弈 题 不懂 推了半天的SG..... 结果这 ...
- Bestcoder round #65 && hdu 5593 ZYB's Tree 树形dp
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...
随机推荐
- Eclipse wtp project dependent project facets问题
wtp project会编译成一个war包,但在eclipse里debug时,依赖的project没有自动编译成jar包并打包到war的lib目录里. 原因:依赖project的facets未设置或未 ...
- Linux命令-目录处理命令:pwd
pwd 显示当前目录的绝对路径
- 使用rman备份异机恢复数据库
一.RMAN备份源库注意点: 最好保留rman备份日志 $rman target / log=backup.log RMAN>run { allocate channel t1 type dis ...
- sql中一列拆成两列
declare @table table (name nvarchar(4))insert into @tableselect '张三' union allselect '李四' union alls ...
- informix-時間格式的各種用法
以下是我在網路上所收集到的關於informix 時間的sql函數用法,有在使用informix資料庫的人,可以參考看看囉! today,返回現在系統日期 current 返回現在日期含時間,相當於sq ...
- [Jobdu] 题目1139:最大子矩阵
题目描述: 已知矩阵的大小定义为矩阵中所有元素的和.给定一个矩阵,你的任务是找到最大的非空(大小至少是1 * 1)子矩阵.比如,如下4 * 4的矩阵 0 -2 -7 09 2 -6 2-4 1 -4 ...
- 每日英语:Do Bicycle Helmet Laws Really Make Riders Safer?
Typically in transportation — and most social arenas, for that matter — laws promoting safety precau ...
- 示例 Demo 工程和 API 参考链接
Camera Explorer:有关 Windows Phone8 中有关增强 Camera API 的使用.文章链接 Filter Effects:对拍摄的照片或者图片库中的照片应用 Nokia I ...
- 三、请求库之requests模块
一 介绍 #介绍:使用requests可以模拟浏览器的请求,比起之前用到的urllib,requests模块的api更加便捷(本质就是封装了urllib3) #注意:requests库发送请求将网 ...
- CSS3多背景应用
/*多背景应用*/ .wrapper { width: 640px; height: 1000px; margin: auto; background: url(./images/head.jpg) ...