首页 > 其他 > 详细

Codeforces Round #259 (Div. 2) C - Little Pony and Expected Maximum

时间:2014-08-02 12:43:43      阅读:334      评论:0      收藏:0      [点我收藏+]

题目链接

题意:

分析:

 1 #include <iostream>
 2 #include <cstring>
 3 #include <cstdlib>
 4 #include <cmath>
 5 #include <cstdio>
 6 #include <vector>
 7 #include <algorithm>
 8 #define LL long long
 9 using namespace std;
10 
11 int main()
12 {
13     int i;
14     double ans, n, m, temp, pre;
15     while(cin>>m>>n)
16     {
17         ans = pow(1.0/m, n);
18         pre = ans;
19         for(i = 2; i <= m; i++)
20         {
21             temp = pow(i/m, n);
22             ans += (temp-pre)*i;
23             pre = temp;
24         }
25 
26         printf("%.4lf\n", ans);
27     }
28     return 0;
29 }

 

Codeforces Round #259 (Div. 2) C - Little Pony and Expected Maximum,布布扣,bubuko.com

Codeforces Round #259 (Div. 2) C - Little Pony and Expected Maximum

原文:http://www.cnblogs.com/bfshm/p/3886679.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!