Counting Lottery Tickets
A regional charity runs small lotteries to raise funds. A ticket names a fixed quantity of numbers picked from a pool, no number twice, and the numbers on a ticket are unordered - a ticket wins if its numbers are the ones drawn, in whatever sequence the balls happened to come out.
The regulator will not approve a draw until the true odds are printed on the back of every ticket, which means somebody has to count how many different tickets exist in the first place. The charity runs a different draw each quarter, with a different pool and a different ticket length, so the count is worked out from the rules it is handed.
Task: Print the total number of distinct tickets the rules allow, as a single integer.
Input
The first line holds the size of the number pool, a whole number of at least 1. The second line holds how many numbers a ticket names, a whole number between 1 and the pool size.
Output
One line holding the number of distinct tickets, as a plain integer - 495, never 495.0.
Example:
Input:
12
4
Output:
495
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in