首页 > 代码库 > Codeforces 453A Little Pony and Expected Maximum 概率题Orz

Codeforces 453A Little Pony and Expected Maximum 概率题Orz

题目链接:点击打开链接

#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
int main()
{
    int i, j;
    double m,n;
    while(cin>>m>>n){
         double ans=m;
         for(i=1;i<=m;i++) 
             ans-=pow((i-1)*1.0/(m),n);
         printf("%.10lf\n",ans);
    }
    return 0;
}