### 11864 - Probability Calculation

Posted:

**Thu Sep 11, 2014 12:31 am**Use this thread to discuss this problem.

The Online Judge board

https://uva.onlinejudge.org/board/

https://uva.onlinejudge.org/board/viewtopic.php?f=53&t=208237

Page **1** of **1**

Posted: **Thu Sep 11, 2014 12:31 am**

Use this thread to discuss this problem.

Posted: **Sat Feb 25, 2017 10:59 pm**

OK, I've figured out how for a given M to split the sum into two parts. The first part can be cached independent of M (for given p), the other part is dependent on M, and has to be recalculated for every M (again, for given fixed p). I get TLE. Is this the approach you took? Do you answer each query in O(M) time?