博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
LightOj 1284
阅读量:7071 次
发布时间:2019-06-28

本文共 1007 字,大约阅读时间需要 3 分钟。

独立考虑,最后推出公式。0.5-0.5*pow(1-p-p,1.0*k);

#include <iostream>

#include <functional>
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <limits>
#include <memory>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
double dp[2][5010][2];
int m1, m2;
double get(double i,double x)
{
    return 1.0-((i-1.0)*(i-1.0)+(x-i)*(x-i))/x/x;
}
int main()
{
    int t, icase = 1;
    scanf("%d", &t);
    while (t--)
    {
        int x,y,z,k;
        scanf ("%d%d%d%d",&x,&y,&z,&k);
        double ans=0;
        for (int i=1;i<=x;i++)
        {
            for (int j=1;j<=y;j++)
            {
                for (int l=1;l<=z;l++)
                {
                    double p=get(i,x)*get(j,y)*get(l,z);
                    ans+=0.5-0.5*pow(1-p-p,1.0*k);
                }
            }
        }
        printf("Case %d: %.12f\n", icase++, ans);
    }
    return 0;
}

转载于:https://www.cnblogs.com/nj-czy/p/5466356.html

你可能感兴趣的文章
问题集录--Java高级软件工程师面试考纲(转)
查看>>
TCL笔试题 将A,B,B,C,D,E,第三个字符不可以是E的所有组合输出;
查看>>
Mysql 数据库系列
查看>>
[C++基础]037_编写不可被继承的类
查看>>
C#_数据库基本交互
查看>>
CSS_样式sample
查看>>
Jordan标准形
查看>>
typeconfig.json配置说明
查看>>
bzoj3551 Peaks加强版
查看>>
phonegap工程中修改app的名字
查看>>
在Exchange数据库中删除指定邮件
查看>>
实例:接口并发限流RateLimiter
查看>>
vba 排序和复制指定区域到新的xls文件中
查看>>
std::strncpy 简介
查看>>
小学生四则运算算术题
查看>>
python并发编程之多进程
查看>>
2019.4.17 区块链论文翻译
查看>>
Loj #2494. 「AHOI / HNOI2018」寻宝游戏
查看>>
浅谈卷积和C++实现
查看>>
RabbitMQ队列/Redis缓存
查看>>