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题的更多相关文章

  1. 集训第六周 古典概型 期望 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 ...

  2. 集训第六周 数学概念与方法 J题 数论,质因数分解

    Description Tomorrow is contest day, Are you all ready? We have been training for 45 days, and all g ...

  3. 集训第六周 数学概念与方法 UVA 11722 几何概型

    ---恢复内容开始--- http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=31471 题意,两辆火车,分别会在[t1,t2],[ ...

  4. CF Gym 100187B A Lot of Joy (古典概型)

    题意:给两个一样的只含有26个小写字母的字符串,然后两个分别做一下排列,问如果对应位置的字母相等那么就愉悦值就加一,问愉悦值的期望是多少? 题解:只考虑两个序列相对的位置,那么就相当于固定一个位置,另 ...

  5. 集训第六周 E题

    E - 期望(经典问题) Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit S ...

  6. python数学第四天【古典概型】

  7. 集训第六周 O题

    Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angle ...

  8. 集训第六周 M题

    Description   During the early stages of the Manhattan Project, the dangers of the new radioctive ma ...

  9. 集训第六周 矩阵快速幂 K题

    Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. F ...

随机推荐

  1. javascript 截取url参数

    var url="http://127.0.0.1:8080/photo/list.jsp?page=2&user=hongchen"; var params_arr = ...

  2. 在xampp集成环境下使用 thinkphp 连接oracle

    今天搞了大半天,终于成功了. 1. 首先需要让xampp支持oracle,直接按这个网页上说的做就行.http://nimal.info/blog/2009/activate-oracle-on-xa ...

  3. POJ3320 Jessica's Reading Problem

    Bryce1010模板 #include <stdio.h> #include <string.h> #include <stdlib.h> #include &l ...

  4. css超出部分显示省略号

    单行文本 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...

  5. windows下Python的安装,以及IDLE的使用

    一.Python的下载安装 (1)python的windows安装包可以从https://www.python.org 网址中下载,可以下载3.4版本的或者2.7版本的.(2)下载后直接运行即可.然后 ...

  6. jmeter(十六)Jmeter之Bean shell使用(二)

    上一篇Jmeter之Bean shell使用(一)简单介绍了下Jmeter中的Bean shell,本文是对上文的一个补充,主要总结下常用的几种场景和方法,相信这些基本可以涵盖大部分的需求.本节内容如 ...

  7. [转]Using the Interop Activity in a .NET Framework 4 Workflow

    本文转自:http://msdn.microsoft.com/en-us/library/ee264174(v=vs.100).aspx This topic applies to Windows W ...

  8. 完美单例宏定义(兼容ARC和MRC),项目中可以直接使用

     单例模式: 1.永远只分配一块内存来创建对象 2.提供一个类方法, 返回内部唯一的一个对象(一个实例) 3.最好保证init方法也只初始化一次 写一个宏定义文件,传入宏定义函数名,自动生成符合类名的 ...

  9. Python学习 Day 5 高阶函数 map/reduce filter sorter 返回函数 匿名函数 装饰器 偏函数

    高阶函数Higher-orderfunction 变量可以指向函数 >>> abs #abs(-10)是函数调用,而abs是函数本身 <built-in function ab ...

  10. OpenGL VAO, VBO 使用简介

    参照代码样例: // This function takes in a vertex, color, index and type array // And does the initializati ...