Allocation
In short, placement is when you have a bunch of different items, and you want to take a few of them and put them in their places. Important clarification: the order is important.
That is, "apple, pear" is not the same as "pear, apple".
In the code, such an operation comes under the name arrangement(n, k)..
Where n is how many items there are, and k is how many you want to select and put in order.
Don't confuse it with permutations — you're shuffling everything there. And here — only a part, and at the same time with respect to their order.
What does this mean mathematically? We take k different elements from a set of n and take into account every possible arrangement. The formula is obtained:
A(n, k) = n! / (n - k)!
If you're not from the "sect" of "I love factorials," I'll explain it in a human way.: we take all the options for how to select the first element, then from the remaining ones, the option for the second, and so on in descending order. That's the whole secret.
Why do you need to know all this? Yes, because placement tasks are constantly encountered. I wanted to put people in their places — this is already a task for accommodation. You select a team where the order in the list is important, that's it again. Not to mention all kinds of Olympiads and tests, where there is nowhere without such things.
So know this: the arrangement function is a useful thing. Small, but with character. It helps to sort out the chaos when there are many and more options. And the brain says, "Stop, let's do the math." That's where she comes into play.
Help on built-in functions
The rules of programming scripts
Programm options
Color constants