c#win中棘手的排列代码问题。形成 [英] Problem with tricky permutation code in c# win. form

查看:50
本文介绍了c#win中棘手的排列代码问题。形成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被困在我的程序中并且需要帮助。



我被困的部分是我需要获得所有可能的可能性具体字符。



示例: -

I am stuck with a part in my program and need help.

The part where i am stuck is that i need to get all possible possibilities with specific characters.

Example:-

int NoOfSpaces = 3;
string[] CharForPossibilities = new string[] {'a','b'};



OUTPUT


OUTPUT

outputStr[0] = "aaa";
outputStr[1] = "bbb";
outputStr[2] = "baa";
outputStr[3] = "aba";
outputStr[4] = "aab";
outputStr[5] = "bba";
outputStr[6] = "bab";
outputStr[7] = "abb";



我不知道如何实现这一点。任何代码片段都不胜感激。







提前致谢


i have no idea how to achieve this. Any code snippet would be appreciated.



Thanks in advance

推荐答案

演变成简化的背包问题。你的所有物品都有相同的尺寸/重量,每个物品的倍数都可以填满。



http://en.wikipedia.org/wiki/Knapsack_problem#Unbounded_knapsack_problem [ ^ ]
Devolves into a simplified knapsack problem. All your items are the same size/weight and you can have multiples of each to fill the sack.

http://en.wikipedia.org/wiki/Knapsack_problem#Unbounded_knapsack_problem[^]


这篇关于c#win中棘手的排列代码问题。形成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆