LightOJ 1284Lights inside 3D Grid (贡献求期望)
来源:互联网 发布:如何禁用javascript 编辑:程序博客网 时间:2024/05/17 23:27
代码
#include <map>#include <set>#include <stack>#include <queue>#include <cmath>#include <string>#include <vector>#include <cstdio>#include <cctype>#include <cstring>#include <sstream>#include <cstdlib>#include <iostream>#include <algorithm>#pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#define MAX 10005#define MAXN 1000005#define maxnode 2005#define sigma_size 2#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define lrt rt<<1#define rrt rt<<1|1#define middle int m=(r+l)>>1#define LL long long#define ull unsigned long long#define mem(x,v) memset(x,v,sizeof(x))#define lowbit(x) (x&-x)#define pii pair<int,int>#define bits(a) __builtin_popcount(a)#define mk make_pair#define limit 10000//const int prime = 999983;const int INF = 0x3f3f3f3f;const LL INFF = 0x3f3f;//const double pi = acos(-1.0);const double inf = 1e18;//const double eps = 1e-9;const LL mod = 1e9+7;const ull mx = 133333331;/*****************************************************/inline void RI(int &x) { char c; while((c=getchar())<'0' || c>'9'); x=c-'0'; while((c=getchar())>='0' && c<='9') x=(x<<3)+(x<<1)+c-'0'; }/*****************************************************/double cal(double a,double b){ return 1-(a-1)*(a-1)/(b*b)-(b-a)*(b-a)/(b*b);}double qpow(double a,int n){ double ans=1; while(n){ if(n&1) ans=ans*a; a=a*a; n>>=1; } return ans;}int main(){ //freopen("in.txt","r",stdin); int t,kase=0; cin>>t; while(t--){ kase++; double x,y,z; int k; cin>>x>>y>>z>>k; double ans=0; for(int i=1;i<=x;i++){ for(int j=1;j<=y;j++){ for(int h=1;h<=z;h++){ double p=cal(i,x)*cal(j,y)*cal(h,z); p=1-2*p; ans+=0.5-0.5*pow(p,k); } } } printf("Case %d: %.6f\n",kase,ans); } return 0;}
0 0
- LightOJ 1284Lights inside 3D Grid (贡献求期望)
- LightOJ 1284 Lights inside 3D Grid (概率期望)
- LightOJ 1284 Lights inside 3D Grid
- light oj 1284 - Lights inside 3D Grid(求期望)
- Lights inside 3D Grid LightOJ
- UVa 11605 : Lights inside a 3d Grid(期望)
- LightOJ-1284 Lights inside 3D Grid (概率&计数)
- Light Oj 1284 Lights inside 3D Grid(概率期望)
- [LightOJ 1284] Lights inside 3D Grid (概率+递推求通项公式)
- UVa 11605 - Lights inside a 3d Grid 期望
- [UVA11605] Lights inside a 3d Grid && 数学期望
- Light oj 1284 Lights inside 3D Grid
- UVA11605 Lights inside a 3d Grid(概率公式)
- LigthOJ1284-Lights inside 3D Grid
- LigthOJ1284-Lights inside 3D Grid
- uva11605 - Lights inside a 3d Grid 概率
- uva 11605 - Lights inside a 3d Grid(概率)
- UVA 11605 - Lights inside a 3d Grid 概率
- sql server登录时出现错误233的解决办法
- 面试题
- jQuery AJAX传JSON数据使用小结
- haproxy image跳转 haproxy匹配 匹配到了就停止,不会继续往下匹配
- 第32课:spark集群安装动手实战及spark为何是大数据必然的现在和未来?
- LightOJ 1284Lights inside 3D Grid (贡献求期望)
- Openjudge 题解01~05 C++
- Swift-->CoreData原生数据库上手操作
- 推销员(优先队列+贪心)
- 记一次 PHP调用Java Webservice
- Python OpenCV 读取并显示图像
- maven-compiler-plugin 指定工程编译JDK
- Java开发环境搭建与配置
- Qt5.6实现的串口调试助手