UVA 11605 Lights inside a 3d Grid
2024-09-28 06:51:04
#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 ;
}
最新文章
- WPF菜单
- DataGridView里CheckBox实现全选控制
- iOS GCD中的dispatch_group
- Sharepoint 2013 发布功能(Publishing features)
- Appium学习路-打包apk和ipa篇
- Repeater控件使用(含删除,分页功能)
- vijos p1002 dp ***
- Loadrunner监控Centos
- SPRING IN ACTION 第4版笔记-第三章ADVANCING WIRING-008-SpEL介绍
- 用c语言程序对显存进行操作
- leetcode &; lintcode for bug-free
- 关于WebApi 跨域问题的解决的方式
- 【Swift】 iOS开发容易产生Bug的地方
- django 2.1 配sql server 2008R2
- Java爬虫模拟登录——不给我毛概二的H某大学
- ABAP-IDOC配置
- springcloud之eureka配置——eureka.instance
- day27(反射之内省机制)
- Percona XtraDB Cluster
- STL容器读书笔记