|
|
#10 Five-Letter Code
You will produce five-letter codes using the letters A, B, C, D, and E.
-You Are not allowed to produce a code that can be constructed by interchanging any two adjacent letters of an existing code.
What is the maximum number of different codes that can be produced according to this rule?
If the problem was asked for three-letter codes using the letters A, B, and C, then the answer would be 18.
AAA, AAB, AAC, ABB, ABC, ACC, BAA, BBA, BBB, BBC, BCA, BCC, CAA, CAB, CBB, CCA, CCB, CCC.
五字母代码
你将用字母A,B,C,D,E生成包含五个字母的代码。
你不允许产生这样的代码:它由一个已存在的代码的相邻两位交换而来。
根据这个规则,最多可以产生多少个不同的代码?
如果问题问的是利用字母A,B,C产生的三字母代码,那么答案是18。
AAA, AAB, AAC, ABB, ABC, ACC, BAA, BBA, BBB, BBC, BCA, BCC, CAA, CAB, CBB, CCA, CCB, CCC.
---------------
三字母还可以用SQL写出来,五个字母难度大得多。
|
|