Awards
Time limit2sMemory limit1024 MB
Count ways to pick k non-adjacent employees out of n in a row, modulo a prime m, with n up to 100000.
- Level
Medium4 of 10
- Topics
- Math, Combinatorics
- Solved
- No attempts yet
Problem
A company decides to give awards to of its employees. The employees stand in a single row, and each employee sees only the people directly next to them. So that every award winner feels singled out, no two award winners may stand next to each other in the row.
Count the ways to hand out awards among the employees in this row, subject to that rule. The count can be very large, so output it modulo the prime .
Input
The first and only line contains three non-negative integers , , and : the number of employees, the number of awards, and a prime modulus (, ).
Output
Print the answer modulo on a single line.