【Virtual Judge】The 2019 China Collegiate Programming Contest Harbin Site-Keeping Rabbits

2021/6/17 18:59:13

本文主要是介绍【Virtual Judge】The 2019 China Collegiate Programming Contest Harbin Site-Keeping Rabbits,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Keeping Rabbits
DreamGrid is the keeper of n rabbits. Initially, the i-th (1≤i≤n) rabbit has a weight of wi.

Every morning, DreamGrid gives the rabbits a carrot of weight 1 and the rabbits fight for the only carrot. Only one rabbit wins the fight and eats the carrot. After that, the winner’s weight increases by 1. The whole process of fighting and eating ends before the next morning.

DreamGrid finds that the heavier a rabbit is, the easier it is to win a fight. Formally, if the weights of the rabbits are w′1,w′2,…,w′n before a fight, the probability that the i-th rabbit wins the fight is
w′i∑j=1nw′j
He wants to know the expected weight of every rabbit after k days (k carrots are given and eaten).

Input
The input contains multiple cases. The first line of the input contains a single integer T (1≤T≤105), the number of cases.

For each case, the first line of the input contains two integers n and k (1≤n≤105,1≤k



这篇关于【Virtual Judge】The 2019 China Collegiate Programming Contest Harbin Site-Keeping Rabbits的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程