The question ： A sieve has m Face to face , And throw it n Time , The expectation of finding the maximum ;

Ideas ： The maximum value is 1 Yes 1 Kind of ,2 Yes 2^{n}-1 Kind of , 3 Yes 3^{n }-2^{n } Kind of So for m There are times when we can do that m^{n }-(m-1)^{n } Kind of , So the probabilities of each are calculated separately , And then multiply it by this value and sum it up .

#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 More articles about

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

- Mouth question 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 The main idea of the topic : Given a m A sieve for noodles , Ask for a throw n Next time , The expectation of getting the maximum number of points Answer key set up f[i] It means to throw <= ...

- Codeforces Round #259 (Div. 1) A. Little Pony and Expected Maximum Mathematical formula conclusion find the law of water problem
A. Little Pony and Expected Maximum Time Limit: 1 Sec Memory Limit: 256 MB Topic linking http://codeforces.c ...

- Codeforces Round #259 (Div. 2) C - Little Pony and Expected Maximum （ Mathematical expectation ）
Topic link The question : One m Face dice , throw n Time , Ask to get the maximum expectation . Ideas : Mathematical expectation , The formula for discrete time is E(X) = X1*p(X1) + X2*p(X2) + …… + Xn*p(Xn) p(xi) Yes. ...

- 【CF 453A】 A. Little Pony and Expected Maximum（ expect 、 Fast power ）
A. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes ...

- E. Little Pony and Expected Maximum（ Combined expectations ）
Title Description : Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megaby ...

- CF453A Little Pony and Expected Maximum expect dp
LINK:Little Pony and Expected Maximum Easy to set state f[i][j] Before presentation i The second maximum is j Probability . It's obvious that But it's very complicated . Consider optimizing . Consider directly finding the maximum value as j Probability ...

- A. Little Pony and Expected Maximum
Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she ...

## Random recommendation

- svn Tool installation and download Tomcat Source code and import eclipse
install 1.svn Download address https://tortoisesvn.net/downloads.html 2. Language pack download 3. Install first svn, Install the language pack directly 4. Right click on the desktop to see the relevant svn Information download To ...

- java.nio.ByteBuffer in flip,rewind,clear Differences in methods
Read and write operations on the buffer must first know the lower limit of the buffer . Upper limit and current position . The value pairs of the following variables Buffer Some operations in a class play a crucial role : limit: All right Buffer All read and write operations will take limit The upper limit is the value of the variable . p ...

- tomcat 6.0.44 “has failed to stop it. This is very likely to create a memory leak” Problem investigation
1. causes In our project, an implementation of cache module adopts ehcache(2.4.3), When the project is deployed to tomcat In the after , Yes tomcat Stop the service ( Click on eclipse Of console The red stop button , It's strange that there are small ...

- Linux-------------- install vim
1. Relevant tips -bash: vim: command not found 2. see vim Whether to install rpm -qa|grep vim vim-en ...

- ASP.NET Excel Data import database
<identity impersonate="true"/> It's simulation IIS Authentication Delete when import error occurs protected void btnImport_Click(o ...

- windows server 2012 R2 Sinicization -- Get along well with Microsoft Azure
Microsoft Azure Trial version of small trial ox knife First of all, you need to apply for an account to get the trial right I am here 1 Yuan free trial , After entering, you can create your own virtual machine and database Let's start with the creation of windows server 2012 R ...

- Applet API
Basics : wx.canIUse(string) boolean wx.canIUse(string schema) Judge the... Of the applet API, Callback , Parameters , Is the component available in the current version . Parameter description ${A ...

- Linux shell Script learning （ One ）
One .shell Script introduction shell The script uses shell Script syntax will shell Commands are organized in the form of documents .Shell Script vs Windows/Dos Batch processing is similar under , The main purpose is to execute a large number of commands through a plain text file at one time ...

- linux Make U Disk start , And custom systems
find u Disk path fdisk -l Write the image to u disc dd if=/root/Downloads/kali-linux-2017.1-amd64.iso of=/dev/sdc customized U Disk boot system : installed ...

- java Hollow diamond
chart 1 To output as shown in the figure 1 The diamond shown , The first reaction is to see what the diamond has . For a long time on the draft paper , Map 1 It turns into a graph 2 A figure represented by a number chart 2 Compare pictures 1 Sum graph 2 It has the following characteristics : (1) chart 2 Each number in represents a graph 1 Each of them ...