zl程序教程

您现在的位置是:首页 >  其它

当前栏目

codeforces——Little Pony and Expected Maximum

and Codeforces maximum expected Little
2023-09-14 08:57:55 时间
所以最后的结果=sum((k/m)^n - ((k-1)/m)^n) (1 =k =m) 不要这样求(k^n/m^n)数据可能会很大! #include iostream #include cstdio #include cmath using namespace std; int main(){ int n, m; while(cin m n){ double sum, cur=pow(1.0/m, n), nt; sum=cur; for(int i=2; i ++i){ nt=pow(i*1.0/m, n); sum+=(nt-cur)*i; cur=nt; printf("%.12lf\n", sum); return 0; }
codeforces Educational Codeforces Round 49 (Rated for Div. 2) C题 刚开始拿到这题很懵逼,知道了别人的思路之后开始写,但是还是遇到很多坑,要求求P2/S最大。p=a b。就是求(a2+ b2 +2ab)/ab最大,也就是a/b +b/a最大。那么题意就很明显了。
Educational Codeforces Round 98 (Rated for Div. 2)B-Toy Blocks You are asked to watch your nephew who likes to play with toy blocks in a strange way. He has n boxes and the i-th box has ai blocks. His game consists of two steps: he chooses an arbitrary box i; he tries to move all blocks from the i-th box to other boxes.