集训第六周 古典概型 期望 C题
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=30728
一个立体方块,每个单位方块都是关闭状态,每次任两个点,以这两点为对角线的一个立方体状态都会进行一次转变,(开变成关,关变成开)
如此进行k次后,问开着的灯的期望值
思路:枚举所有的X,Y,Z,此灯被选中的概率为p=((2*(N-x+1)*x-1)*(2*(M-y+1)*y-1)*(2*(Z-z+1)*z-1))/(N*N*M*M*Z*Z)
这一点最后开着的期望值为(1-(1-2*p)^2)/2
最后累加期望值即可
#include"iostream"
#include"cstdio"
#include"cstring"
#include"cmath"
#include"algorithm"
using namespace std; int n,m,p,k,ca;
double ans; void Init()
{
scanf("%d%d%d%d",&n,&m,&p,&k);
} void Work()
{
int x,y,z;
ans=;
for(x=;x<=n;x++)
{
for(y=;y<=m;y++)
{
for(z=;z<=p;z++)
{
double P=((2.0*(n-x+)*x-)*(2.0*(m-y+)*y-)*(2.0*(p-z+)*z-))/(double(n)*n*m*m*p*p); ans+=(1.0-pow((1.0-*P),k))/;
}
}
}
} void Print()
{
printf("Case %d: %.10f\n",ca++,ans);
} int main()
{
int T;
cin>>T;
ca=;
while(T--)
{
Init();
Work();
Print();
}
return ;
}
集训第六周 古典概型 期望 C题的更多相关文章
- 集训第六周 古典概型 期望 D题 Discovering Gold 期望
Description You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell o ...
- 集训第六周 数学概念与方法 J题 数论,质因数分解
Description Tomorrow is contest day, Are you all ready? We have been training for 45 days, and all g ...
- 集训第六周 数学概念与方法 UVA 11722 几何概型
---恢复内容开始--- http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=31471 题意,两辆火车,分别会在[t1,t2],[ ...
- CF Gym 100187B A Lot of Joy (古典概型)
题意:给两个一样的只含有26个小写字母的字符串,然后两个分别做一下排列,问如果对应位置的字母相等那么就愉悦值就加一,问愉悦值的期望是多少? 题解:只考虑两个序列相对的位置,那么就相当于固定一个位置,另 ...
- 集训第六周 E题
E - 期望(经典问题) Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit S ...
- python数学第四天【古典概型】
- 集训第六周 O题
Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angle ...
- 集训第六周 M题
Description During the early stages of the Manhattan Project, the dangers of the new radioctive ma ...
- 集训第六周 矩阵快速幂 K题
Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. F ...
随机推荐
- RabbitMQ学习之HelloWorld(1)
RabbitMQ就是一个消息代理(message broker),可以用来接收和发送消息. 消息队列有一些黑话,我们来看下: Producer : 发送message的程序 Queue : 可以用来存 ...
- 暑期训练狂刷系列——Lightoj 1084 - Winter bfs
题目连接: http://www.lightoj.com/volume_showproblem.php?problem=1084 题目大意: 有n个点在一条以零为起点的坐标轴上,每个点最多可以移动k, ...
- bzoj 1858: [Scoi2010]序列操作 || 洛谷 P2572
记一下:线段树占空间是$2^{ceil(log2(n))+1}$ 这个就是一个线段树区间操作题,各种标记的设置.转移都很明确,只要熟悉这类题应该说是没有什么难度的. 由于对某区间set之后该区间原先待 ...
- A8通用权限框架
- javascript实现弹层效果
首先,需要有一个按钮来模拟登录: <button id="btnLogin"class="login-btn">登录</button> ...
- 迅为八核cortex a53开发板android/linux/Ubuntu系统
详情请点击了解:http://www.topeetobard.com 店铺:https://arm-board.taobao.com 核心板: 提供1G和2G内存版本,全机器焊接,杜绝手工,批量无忧. ...
- laravel UserRequest $request error
laravel UserRequest $request error Ask Question 0 laravel5.2,I create a UserRequest.php under Re ...
- width:100px; min-width:100% 解释:宽度大于100px 就是100% 小于100px 就是100像素
<div style="width:100px; background-color: aqua; min-width:100%">kkk</div>
- lua 之 三木运算符
在c语言中我三目运算符这么写: a?b:c 例如: max = a>b?a:b; 在lua中我们这么写 max = a>b and a or b 运行如下:
- E. String Multiplication
E. String Multiplication time limit per test 2 seconds memory limit per test 256 megabytes input sta ...