How to do modulu operations and modulu inverse by non prime numbers?

Правка en1, от habib_rahman, 2017-02-24 09:34:30

Given N distinct integers from 1 to N, you have to find the number of ways the N integers can be rearranged in M empty slots such that, no integer matches with its slot index. Note that, slots are indexed from 1 to M.

Print the number of ways modulo 23377788.

0<=N<=M<100000 and It has 200 test cases.

I came up with a solution like this but not sure its correct or not. And have not any idea to modulu it by non prime. My solution

Теги derangement, modulo, modular inverse

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский habib_rahman 2017-02-24 09:39:35 78
en2 Английский habib_rahman 2017-02-24 09:38:01 11 Tiny change: 'prime.\n![My solution ](http://' -> 'prime.\n![ ](http://' (published)
en1 Английский habib_rahman 2017-02-24 09:34:30 549 Initial revision (saved to drafts)