题意:一个筛子有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; int n,m; int main()
{
cin>>m>>n;
double x=pow(1.0/m,n);
double ans=x;
for(int i=; i<=m; i++)
{
double xx=pow(i*1.0/m,n);
ans+=(xx-x)*i;
x=xx;
}
printf("%.12lf\n",ans);
return ;
}
codeforces C. Little Pony and Expected Maximum的更多相关文章
-
CodeForces 454C Little Pony and Expected Maximum
Little Pony and Expected Maximum Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I6 ...
-
嘴巴题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 ...
-
CodeForces - 453A Little Pony and Expected Maximum
http://codeforces.com/problemset/problem/453/A 题目大意: 给定一个m面的筛子,求掷n次后,得到的最大的点数的期望 题解 设f[i]表示掷出 <= ...
-
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 ...
-
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)的是 ...
-
【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 ...
-
E. Little Pony and Expected Maximum(组合期望)
题目描述: Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megaby ...
-
CF453A Little Pony and Expected Maximum 期望dp
LINK:Little Pony and Expected Maximum 容易设出状态f[i][j]表示前i次最大值为j的概率. 转移很显然 不过复杂度很高. 考虑优化.考虑直接求出最大值为j的概率 ...
-
A. Little Pony and Expected Maximum
Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she ...
随机推荐
-
精通D3.js学习笔记(2)比例尺和坐标
1.线性比例尺 d3.scale.linear() 创建一个线性比例尺 .domain([0,500]) 定义域 .range([0,1000]) 值域 l ...
-
Android 添加Button事件
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentV ...
-
-_-#【Angular】自定义过滤器
AngularJS学习笔记 <!DOCTYPE html> <html ng-app="Demo"> <head> <meta chars ...
-
VSTO学习笔记(十五)Office 2013 初体验
原文:VSTO学习笔记(十五)Office 2013 初体验 Office 2013 近期发布了首个面向消费者的预览版本,我也于第一时间进行了更新试用.从此开始VSTO系列全面转向Office 201 ...
-
编写Qt Designer自定义控件
一)流程概述 在使用Qt Designer设计窗体界面时,我们可以使用Widget Box里的窗体控件非常方便的绘制界面,比如拖进去一个按钮,一个文本编辑器等.虽然Qt Designer里的控件可以满 ...
-
一起学Android之GridView
本文以一个简单的小例子,简述Android开发中GridView的常见应用,仅供学习分享使用. 概述 GiridView是一个表格显示资源的控件,可以在两个可滚动的方向上显示.列表项的资源会通过Lis ...
-
opencv自带fast_math.hpp
cvRound cvFloor cvCeil cvIsNaN cvIsInf
-
[hive] hive 内部表和外部表
1.内部表 hive (test1)> create table com_inner_person(id int,name string,age int,ctime timestamp) row ...
-
Apache 强制Http跳转Https
找到网站根目录的.htaccess文件,添加如下代码 RewriteEngine On RewriteCond %{SERVER_PORT} RewriteRule ^(.*)$ https://%{ ...
-
nodejs .http模块, cheerio模块 实现 小爬虫.
代码: var http = require("http"); var cheerio = require("cheerio"); var url = 'htt ...