#P1358. 扑克牌
扑克牌
Description
Combinatorics is an important branch of mathematics that studies discrete objects. It mainly focuses on problems about the existence, counting, and construction of configurations (also called combinatorial models) that satisfy certain conditions. Its main topics include combinatorial counting, combinatorial design, combinatorial matrices, and combinatorial optimization.
With the rapid development of computer science, the importance of combinatorics has become more and more evident, because the core of computer science is using algorithms to process discrete data.
Today we study an interesting and simple counting problem in combinatorics:
From a deck of distinct playing cards, deal to people; the -th person receives cards. Find the number of ways to do this. This number may be very large; please output the result modulo .
Input Format
The first line contains two integers .
The second line contains integers .
Output Format
Output the result modulo .
5 2
3 1
20
20 19
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
8707
Hint
For of the testdata: .
For of the testdata: , , .
Translated by ChatGPT 5
京公网安备 11011102002149号