Problem Description
Loading...
Problem Analysis
This problem also got me stuck for quite a while
At first I thought it was just simple permutations and combinations
But now it looks like it’s actually a Derangement problem
What’s different from an ordinary Derangement is that here the grooms are distinct from one another
So which ones are matched correctly (and which ones are matched incorrectly) also differs
Therefore, this must also be taken into account when counting the possibilities
An array is used here to store the Derangement data
Another array stores the factorial data
This saves time
cpp
| |
Problem link: [HDU][2049] Not Easy Series (4) — Testing the Groom