Search found 3 matches

by [Iasi] georgepopoiu
Sun Nov 09, 2014 4:12 pm
Forum: Algorithms
Topic: Computing n choose k modulo composite m
Replies: 1
Views: 2921

Computing n choose k modulo composite m

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...
by [Iasi] georgepopoiu
Wed Oct 08, 2014 7:55 am
Forum: Algorithms
Topic: Segment Tree question
Replies: 1
Views: 1224

Segment Tree question

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...
by [Iasi] georgepopoiu
Thu Aug 07, 2014 12:49 pm
Forum: Other words
Topic: MAIN : Take-Out
Replies: 0
Views: 2353

MAIN : Take-Out

Hello, I'm trying to solve this task : 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 :

Go to advanced search