水了一上午。。

拿6面举例子吧,因为是投掷m次取最大,最大是1概率(1/6)^m;最大是2就可以取到(1,2)那么概率就是(1/3)^m-(1/6)^m。(当前减去上一个)

 #include<bits/stdc++.h>
#define LL long long
#define LD long double
#define N 100005
using namespace std;
inline int ra()
{
int x=,f=; char ch=getchar();
while (ch<'' || ch>'') {if (ch=='-') f=-; ch=getchar();}
while (ch>='' && ch<='') {x=x*+ch-''; ch=getchar();}
return x*f;
}
double ksm(double a, int p)
{
double sum=;
for (;p;p>>=,a*=a)
if (p&)
sum*=a;
return sum;
}
int main()
{
int n=ra(),m=ra();
double ans=;
for (int i=; i<=n; i++)
ans+=(double)i*(ksm((double)i/n,m)-ksm((double)(i-)/n,m));
printf("%.12lf",ans);
return ;
}

cf 453A.Little Pony and Expected Maximum的更多相关文章

  1. 嘴巴题9 Codeforces 453A. Little Pony and Expected Maximum

    A. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes ...

  2. CodeForces - 453A Little Pony and Expected Maximum

    http://codeforces.com/problemset/problem/453/A 题目大意: 给定一个m面的筛子,求掷n次后,得到的最大的点数的期望 题解 设f[i]表示掷出 <= ...

  3. 【CF 453A】 A. Little Pony and Expected Maximum(期望、快速幂)

    A. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes ...

  4. CodeForces 454C Little Pony and Expected Maximum

    Little Pony and Expected Maximum Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I6 ...

  5. Codeforces Round #259 (Div. 2) C - Little Pony and Expected Maximum (数学期望)

    题目链接 题意 : 一个m面的骰子,掷n次,问得到最大值的期望. 思路 : 数学期望,离散时的公式是E(X) = X1*p(X1) + X2*p(X2) + …… + Xn*p(Xn) p(xi)的是 ...

  6. Codeforces Round #259 (Div. 1) A. Little Pony and Expected Maximum 数学公式结论找规律水题

    A. Little Pony and Expected Maximum Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.c ...

  7. E. Little Pony and Expected Maximum(组合期望)

    题目描述: Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megaby ...

  8. CF453A Little Pony and Expected Maximum 期望dp

    LINK:Little Pony and Expected Maximum 容易设出状态f[i][j]表示前i次最大值为j的概率. 转移很显然 不过复杂度很高. 考虑优化.考虑直接求出最大值为j的概率 ...

  9. A. Little Pony and Expected Maximum

    Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she ...

随机推荐

  1. 厉害了!SpringBoot是如何动起来的!

    程序入口 SpringApplication.run(BeautyApplication.class, args); 执行此方法来加载整个SpringBoot的环境. 1. 从哪儿开始? Spring ...

  2. xcode 6 如何将 模拟器(simulator) for iphone/ipad 转变成 simulator for iphone

    xcode 6默认模拟器是iphone/ipad通用的,如果想只针对iphone或者ipad可以进行如下设置: 1.修改模拟器大小(非必须) 模拟器->WIndow->scale-> ...

  3. Git如何合并Commit

    如果你在 push 你的修改之前想要将本地多次修改后的 commit 合并一下变得更好看,可以使用下面的方法. 指定你要合并的 commit 相关的命令有两种 你可以通过指定修改过去的几个 commi ...

  4. windowsService 程序

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  5. ffmpeg 学习:001-搭建开发环境

    介绍 由于命令行的ffmpeg工具无法满足产品的性能要求,需要对视频流进行兼容.所以需要调试有关的参数. FFmpeg全名是Fast Forward MPEG(Moving Picture Exper ...

  6. InnoDB 和 MyISAM的索引区别

    MyISAM索引实现 MyISAM索引文件和数据文件是分离的,索引文件的data域保存记录所在页的地址(物理存储位置),通过这些地址来读取页,进而读取被索引的行数据. MyISAM的索引原理图如下,C ...

  7. 图片索引 lire

    1:定义  LIRE( Lucene Image Retrieval)相似图像索引和搜索机制 2:资料来源     LIRE官网:http://www.semanticmetadata.net/lir ...

  8. 使用BP拦截POST型请求包

    1.安装phpstudy并下载wordpress 文件,安装在phpstudy的www目录下 phpstudy下载地址:https://www.xp.cn/download.html wordpres ...

  9. mysql 添加索引语句

    1.PRIMARY  KEY(主键索引)        mysql>ALTER  TABLE  `table_name`  ADD  PRIMARY  KEY (  `column`  ) 2. ...

  10. linux下python开发环境的安装

    1.准备编译环境 yum groupinstall 'Development Tools' yum install zlib-devel bzip2-devel openssl-devel ncurs ...