计算排列的数量
嘿,我正在学习 DS&A 课程,我们有一个关于计算排列的有趣的作业问题。问题如下:
有 N(N <= 15) 个人,每个人的 id 从 1 到 N。所有 N 个人都有一个他们愿意接受的号码列表。您有一个大小为 N 个数字的数组,称为 A。您可以随意排列A。对于每个排列,A 中的第一个数字属于第一个人,第二个数字属于第二个人,依此类推。对于每个人来说,A 的排列数是多少,A 中分配给他们的数字也在他们的列表中?
我曾尝试考虑使用有向图,但无法弄清楚。有人能指出我正确的方向吗?
谢谢!
Hey I'm taking a DS&A course, and we had an interesting homework question regarding counting permutations. The problem is the following:
There is are N(N <= 15) people each with an id from 1 to N. All N people have a list of numbers they will accept. You have an array of size N numbers called A. You can permutate A however you like. For each permutation, the first number in A goes to the first person, the second number goes to the second person, and so on. What is the number of permutations of A where, for every person, their assigned number in A is also in their list?
I've tried thinking about using directed graphs, but couldn't figure it out. Could someone point me in the right direction?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论