我的代码遍历 5 个字符长的单词中 ABC 字符的所有可能组合,并打印出它们的数量。如何在 C# 中编写此代码?
from itertools import product
combinations = product("ABC", repeat=5)
count = 0
for i in combinations:
count += 1
print(count)
我的代码遍历 5 个字符长的单词中 ABC 字符的所有可能组合,并打印出它们的数量。如何在 C# 中编写此代码?
from itertools import product
combinations = product("ABC", repeat=5)
count = 0
for i in combinations:
count += 1
print(count)
直积(Cartesian Product)可以计算如下
像这样写你的代码
控制台输出
我之前在这里发布了对解决方案的详细分析。