【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
标签:Keeping,rabbits,weight,Contest,contains,fight,carrot,rabbit,Rabbits 来源: https://blog.51cto.com/u_14013325/2918034