Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official. ×

### Tobby_And_Friends's blog

By Tobby_And_Friends, history, 23 months ago, ,

I could figure out that let's say for 5 numbers the answer is (Arr[1] + 4 * Arr[2] + 6 * Arr[3] + 4 * Arr[4] + Arr[5])/2^16. So the problem basically reduces to finding the values in the nth row of pascal's triangle and power of 2. But I am not very sure as to how to implement the solution. Any help is really appreciated.

 » 23 months ago, # | ← Rev. 2 →   0 HINT: If you calculate in the paper, you will see answer is
 » 23 months ago, # |   0 You can use the fact that , i.e. no need of pre-computation. You can find a similar problem here
•  » » 23 months ago, # ^ |   0 Yeah, recursively like C(n,  k)  =  C(n,  k  -  1)  *  (n  -  k  -  1)  /  k
 » 23 months ago, # |   0 HINT 2: Number of combinations can calculated recursively: C(n, k) = C(n, k - 1) * (n - k - 1) / kAlso C(n, 0) = 1
 » 23 months ago, # |   +3 HINT 3: For bigger n finding combination will not be work, so use logarithm : )
 » 23 months ago, # |   0 If you couldn't solve, see solution with logarithm and numerical combinations