Codeforces 453A Little Pony and Expected Maximum

题面在这里

\[ \sum_{i=1}^m i\cdot \left[\left( \frac i m \right)^n - \left( \frac {i-1} m \right)^n\right] \]

示例程序:

1
2
3
4
5
6
7
8
9
10
11
#include<cstdio>
#include<cmath>

int n,m;
int main(){
scanf("%d%d",&m,&n);
double ans=0;
for (int i=1;i<=m;i++) ans+=i*(pow(1.0*i/m,n)-pow(1.0*(i-1)/m,n));
printf("%.08f",ans);
return 0;
}