UVA 11605 Lights inside a 3d Grid

#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
using namespace std; double GetP(int x, int N)
{
return (2.0*x*(N-x+)-)/N/N;
} double P2E(double p, int k)
{
return (-pow(-*p, k))/;
} double GetE(int N, int M, int P, int K)
{
double px,py,pz;
double e=;
for(int x=;x<=N;x++)
{
px = GetP(x, N);
for(int y=;y<=M;y++)
{
py = GetP(y, M);
for(int z=;z<=P;z++)
{
pz = GetP(z, P);
e += P2E(px*py*pz, K);
}
}
}
return e;
} int main()
{
int N,M,P,K;
int t;
scanf("%d",&t);
for(int i=;i<=t;i++)
{
scanf("%d%d%d%d", &N,&M,&P,&K);
printf("Case %d: %.10lf\n", i, GetE(N,M,P,K));
}
return ;
}
UVA 11605 Lights inside a 3d Grid的更多相关文章
- uva 11605 - Lights inside a 3d Grid(概率)
option=com_onlinejudge&Itemid=8&page=show_problem&problem=2652" style=""& ...
- UVA 11605 Lights inside a 3d Grid —— (概率和期望)
题意:见大白书P181. 分析:一个一个点的进行分析,取其期望然后求和即可.假设当前点在第一次中被选到的概率为p,f[i]表示进行k次以后该点亮的概率(在这里也可以理解为期望),g[i]表示k次后该点 ...
- Lights inside a 3d Grid UVA - 11605(概率)
题意: 给出一个n * m * h的空间 每次任意选择两个点 使得在以这两个点连线为对角线的空间的点的值 取反 (初始为0) 求经过k次操作后最后有多少点的值为1 解析: 遇到坐标分维去看 把三 ...
- Lights inside 3D Grid LightOJ - 1284 (概率dp + 推导)
Lights inside 3D Grid LightOJ - 1284 题意: 在一个三维的空间,每个点都有一盏灯,开始全是关的, 现在每次随机选两个点,把两个点之间的全部点,开关都按一遍:问k次过 ...
- LightOJ - 1284 Lights inside 3D Grid —— 期望
题目链接:https://vjudge.net/problem/LightOJ-1284 1284 - Lights inside 3D Grid PDF (English) Statistic ...
- LightOJ1284 Lights inside 3D Grid (概率DP)
You are given a 3D grid, which has dimensions X, Y and Z. Each of the X x Y x Z cells contains a lig ...
- LightOJ - 1284 Lights inside 3D Grid (概率计算)
题面: You are given a 3D grid, which has dimensions X, Y and Z. Each of the X x Y x Z cells contains a ...
- 3D Grid Effect – 使用 CSS3 制作网格动画效果
今天我们想与大家分享一个小的动画概念.这个梦幻般的效果是在马库斯·埃克特的原型应用程序里发现的.实现的基本思路是对网格项目进行 3D 旋转,扩展成全屏,并呈现内容.我们试图模仿应用程序的行为,因此 ...
- LightOj_1284 Lights inside 3D Grid
题目链接 题意: 给一个X * Y * Z 的立方体, 每个单位立方体内都有一盏灯, 初始状态是灭的, 你每次操作如下: 1)选择一个点(x1, y1, z1) 再选择一个点(x2, y2, ...
随机推荐
- Python 5 面对对象编程
面向对象编程: 面向过程:根据业务逻辑从上到下写垒代码 函数式:将某功能代码封装到函数中,日后便无需重复编写,仅调用函数即可 面向对象:对函数进行分类和封装,让开发“更快更好更强...” 面向过程编程 ...
- 【转】dmesg 时间转换
dmesg 时间转换 dmesg 输出的格式不易查看,可以通过命令进行转换. 记录如下: 时间查看: date -d "1970-01-01 UTC `echo "$(date + ...
- matlab fread
Matlab中fread函数用法 “fread”以二进制形式,从文件读出数据. 语法1:[a,count]=fread(fid,size,precision) 语法2:[a,count]=fre ...
- redis操作封装整理
<?php /** * redis操作类 * 说明,任何为false的串,存在redis中都是空串. * 只有在key不存在时,才会返回false. * 这点可用于防止缓存穿透 * */ cla ...
- 【CodeChef】Small factorials(BigInteger笔记)
You are asked to calculate factorials of some small positive integers. Input An integer t, 1<=t&l ...
- mongodb php 支持
http://bbs.csdn.net/topics/391931404?page=1 windows下为php7.0.4安装目前官方版本对应的最新的php_mongodb.dll扩展,该扩展版本为1 ...
- python中编写无参数decorator
Python的 decorator 本质上就是一个高阶函数,它接收一个函数作为参数,然后,返回一个新函数. 使用 decorator 用Python提供的 @ 语法,这样可以避免手动编写 f = de ...
- Mysql 主从复制搭建
Mysql 主重复制搭建 Linux版本:Linux Centos 6.4 32位 Mysql版本:Mysql-5.6.38-linux-glibc2.12-i686 Mysql安装:Mysql安装教 ...
- 常用display属性
table 1. 宽高由内容撑开 2.独占一行 3.可设置宽高 4.可设置margin.padding inline-table 与display: table大体一致,区别在于不独占一行,为行内元素 ...
- 一言(ヒトコト)Hitokoto API
『想要成为无论多么悲伤的时候,也能够漂亮微笑的人吧.』 Hitokoto API 更新:2014.02.22 问题/反馈:api # hitokoto.us 数据获取:[ 数据获取 ] 调用举例:[ ...