【发布时间】:2012-07-18 05:15:21
【问题描述】:
你可以用多少种方式排列一个“n”(1 到 n)个数字的序列,使得在其值所代表的索引处没有数字出现?
例如
1 can not be at first position
2 can not be at second position
.
.
n can not be at nth position
请给出一个通用的解决方案。也解决它为n = 6。 这不是家庭作业。
【问题讨论】:
-
如果它走路像鸭子,说话像鸭子......你确定这不是家庭作业吗?
-
如何以编程方式生成紊乱的问题已经dealt with previously here。严格来说,计算它们的公式是一个数学主题(请参阅我在 MathSE 上链接到此类问题的答案)。
标签: algorithm math permutation