public void test()
{
int[] data = { 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9 };
List
for (int i = 0; i < data.Length; i++)
{
printNum(data, data.Length, i + 1, 0, 0, ref totalList);
}
List
string str = string.Empty;
foreach (int val in totalList)
{
if (!uniList.Contains(val))
{
uniList.Add(val);
str += val + ",";
}
}
}
public void printNum(int[] data, int n, int k, int sum, int start,ref List
{
if (k == 0)
{
totalList.Add(sum);
return;
}
int i;
for (i = start; i < n; ++i)
{
printNum(data, n, k - 1, sum + data[i], i + 1, ref totalList);
}
}