四个ABC加一起有多少种组合方式
2022-11-24
四个ABC,也就是AAAABBBBCCCC,一共可以有多少种组合?
A可以选0到4个,也就是可以有5种选择,B和C也是一样。一共有 5³ = 125个组合;
其中,全部不选(即空选)有1种,要剔除;
所以,一共有 125-1 = 124 种不同的组合。
~~~~~~~~~~~~~~~~~~~~~~~~~~
可以编程列出所有这些组合,当然手工也可以。
具体如下:
C,CC,CCC,CCCC,B,BC,BCC,BCCC,BCCCC,BB,BBC,BBCC,BBCCC,BBCCCC,BBB,BBBC,BBBCC,BBBCCC,BBBCCCC,BBBB,BBBBC,BBBBCC,BBBBCCC,BBBBCCCC,A,AC,ACC,ACCC,ACCCC,AB,ABC,ABCC,ABCCC,ABCCCC,ABB,ABBC,ABBCC,ABBCCC,ABBCCCC,ABBB,ABBBC,ABBBCC,ABBBCCC,ABBBCCCC,ABBBB,ABBBBC,ABBBBCC,ABBBBCCC,ABBBBCCCC,AA,AAC,AACC,AACCC,AACCCC,AAB,AABC,AABCC,AABCCC,AABCCCC,AABB,AABBC,AABBCC,AABBCCC,AABBCCCC,AABBB,AABBBC,AABBBCC,AABBBCCC,AABBBCCCC,AABBBB,AABBBBC,AABBBBCC,AABBBBCCC,AABBBBCCCC,AAA,AAAC,AAACC,AAACCC,AAACCCC,AAAB,AAABC,AAABCC,AAABCCC,AAABCCCC,AAABB,AAABBC,AAABBCC,AAABBCCC,AAABBCCCC,AAABBB,AAABBBC,AAABBBCC,AAABBBCCC,AAABBBCCCC,AAABBBB,AAABBBBC,AAABBBBCC,AAABBBBCCC,AAABBBBCCCC,AAAA,AAAAC,AAAACC,AAAACCC,AAAACCCC,AAAAB,AAAABC,AAAABCC,AAAABCCC,AAAABCCCC,AAAABB,AAAABBC,AAAABBCC,AAAABBCCC,AAAABBCCCC,AAAABBB,AAAABBBC,AAAABBBCC,AAAABBBCCC,AAAABBBCCCC,AAAABBBB,AAAABBBBC,AAAABBBBCC,AAAABBBBCCC,AAAABBBBCCCC,
total = 124
附:fortran代码