What are the best ways to calculate nCr (n choose r) mod m where m is a large prime and n, r are smaller than m?
created
last reply
- 2
replies
- 741
views
- 2
users
- 2
links
What are the best ways to calculate nCr (n choose r) mod m where m is a large prime and n, r are smaller than m?
I was referring to this problem: http://www.spoj.com/problems/RIVALS/28
I got AC with pre-calculation of factorial values with PyPy but still TLE with Pyth 2.7
Any ideas?