Little Pony and Expected Maximum Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 454C Description Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter…
A. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept…
http://codeforces.com/problemset/problem/453/A 题目大意: 给定一个m面的筛子,求掷n次后,得到的最大的点数的期望 题解 设f[i]表示掷出 <= i 的点数的概率 ans = sigma{i*(f[i]-f[i-1])} 单个f[i]直接快速幂计算 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typede…
题意:一个筛子有m个面,然后扔n次,求最大值的期望; 思路:最大值为1 有1种,2有2n-1种,  3有3n -2n 种   所以为m的时有mn -(m-1)n 种,所以分别求每一种的概率,然后乘以这个值求和就可以. #include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include <algorithm> using namespace std;…
A. Little Pony and Expected Maximum Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/453/problem/A Description Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing.…
题目链接 题意 : 一个m面的骰子,掷n次,问得到最大值的期望. 思路 : 数学期望,离散时的公式是E(X) = X1*p(X1) + X2*p(X2) + …… + Xn*p(Xn) p(xi)的是所有最大值是xi的情况数/总情况数一共是m^n种,掷n次,所有最大值是xi的情况数应该是xi^n,但是这里边却包含着最大值非xi且不超过xi的种数,所以再减去最大值是xi-1或者最大值不超过这个的情况数.即sum += xi * (xi^n-(xi-1)^n)/m^n,但是这样求肯定是不行,因为m…
A. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept…
题目描述: Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she k…
LINK:Little Pony and Expected Maximum 容易设出状态f[i][j]表示前i次最大值为j的概率. 转移很显然 不过复杂度很高. 考虑优化.考虑直接求出最大值为j的概率 对于1显然\((\frac{1}{m})^n\) 对于2 显然有\((\frac{2}{m})^n\)不过这其中有一部分是1的概率容斥掉即可. 对于更大的点数也是如此记一个前缀和sum就好了. (不过这个前缀和是不必要的 刚好等于上一次求出的概率 需要小数快速幂 就没了. const ll MAX…
Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game. The dice has m faces: the firs…