Arranging Books on a Shelf
The window display at Whetcode Books has a row of slots, and a shortlist of new titles is in the running. Position is part of the display: the designer treats the same titles read left to right in a different sequence as a different window, and no title can appear in two slots at once. Any titles she does not use stay in the stockroom.
She redresses the window every month with a different shortlist and a different number of slots, and she wants the size of the space she is choosing from before she starts photographing options.
Task: Print how many distinct windows can be built from the shortlist, as a single integer.
Input
The first line holds how many titles are on the shortlist, a whole number of at least 1. The second line holds how many slots the window has, a whole number between 1 and the number of titles.
Output
One line holding the number of distinct windows, as a plain integer - 360, never 360.0.
Example:
Input:
6
4
Output:
360
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