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.
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.
相关文章
- codeforces Fedor and New Game
- [Docker] Install Docker on Windows (hp) and start with Kitematic
- C++ code:char pointers and char arrays(字符指针与字符数组)
- [Jest] Using Jest toHaveBeenCalledWith for testing primitive data types and partial objects
- [Node.js] Web Scraping with Pagination and Advanced Selectors
- IBASE change and save - Middleware related
- Atitit. Xss 漏洞的原理and应用xss木马
- 【CodeCraft-19 and Codeforces Round #537 (Div. 2) C】Creative Snap
- 【Codeforces Round #447 (Div. 2) C】Marco and GCD Sequence
- 【25.00%】【codeforces 584E】Anton and Ira
- 【38.24%】【codeforces 621E】 Wet Shark and Blocks
- 【47.40%】【codeforces 743B】Chloe and the sequence
- 【codeforces 768C】Jon Snow and his Favourite Number
- 【codeforces 546A】Soldier and Bananas
- 【codeforces 510D】Fox And Jumping
- 【codeforces 515D】Drazil and Tiles
- 已解决TabError: Inconsistent use of tabs and spaces in indentation