Search found 3 matches
Search found 3 matches • Page 1 of 1
- Sun Nov 09, 2014 4:12 pm
- Forum: Algorithms
- Topic: Computing n choose k modulo composite m
- Replies: 1
- Views: 2921
Hello, I am trying to compute C(n, k) = n! / ( (n - k)! * k! ) mod m without using the recurrence relation C(n, k) = C(n - 1, k) + C(n-1, k-1). m might be a composite number and we might have n >= m. I know how to do it mod p where p is prime and we have n < p, but in my case the modulus is composit...
Hello, I recently remembered a problem statement that was something like this : We have an array A of n integers and we need to answer the following type of queries. Q(l, r, p) means how many numbers from A[l..r] are less than p. The author mentioned that it can be done using a segment tree, but did...
Hello, I'm trying to solve this task : http://main.edu.pl/en/archive/oi/20/usu Someone suggested that I can use a queue, but I cannot wrap my head around it. I cannot find a way to use it that is good in all cases. Anyone can give me some more hints ? The tests are also available : http://main.edu.p...