集训第六周 古典概型 期望 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 ...
随机推荐
- _bzoj1070 [SCOI2007]修车【最小费用最大流】
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1070 以后做网络流题目就是不能省内存... #include <cstdio> ...
- 题解报告:poj 2533 Longest Ordered Subsequence(最长上升子序列LIS)
Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence ...
- Arrays.asList()后调用add,remove这些method时出现java.lang.UnsupportedOperationException异常
String[] queryNames = request.getParameterValues("queryName"); List<String> queryNam ...
- jdk 1.8下 java ArrayList 添加元素解析
转载请注明http://www.cnblogs.com/majianming/p/8006452.html 有人问我,java ArrayList底层是怎么实现的?我就回答数组,他再问我,那它是怎么实 ...
- html 相对定位 绝对 定位 css + div
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 0 Transitional//EN""http://www.worg/TR/xh ...
- 关于C# DropDownList 动态加载数据笔记
今天在处理一个导游注册的页面,其中需要填写地址以及该地址下所有旅行社,地址区级以上都是用下拉列表实现,具体地址街道等手动填写.在填写区县之后,该区县下的所有旅行社也需要动态加载. 后台代码 DataT ...
- ie浏览器和火狐浏览器对对容器宽度定义的差异
首先我们说说firefox和IE对CSS的宽度显示有什么不同: 其实CSS ’width’ 指的是标准CSS中所指的width的宽度,在firefox中的宽度就是这个宽度.它只包含容器中内容的宽度.而 ...
- JS操作CSS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- ActiveSync日志分析
Here are the steps to exporting the ActiveSync log data: Create a folder on the root of C:\ ...
- photoshop cs6安装和破解步骤
http://tieba.baidu.com/p/4791130877 http://www.frontopen.com/1181.html