const string splitor = "----";
void Main()
{
var r = Dp(new List(){"a","b","c","d","e","f","g"});
Console.WriteLine(r);
//print combosition count
var count = 0;
for(var i = 0 ;i < r.Count; i++){
var c = Regex.Matches(r[i], splitor).Count;
count += c + 1;
}
Console.WriteLine(string.Format("total : {0}",count));
}
//Dp[0] = "a[0],a[1],...a[n]"
//Dp[i] = Dp[i-1] cross with Dp[0]
static ListDp(Listarr){
if(arr == null || arr.Count == 0){
return new List();
}
var dpArr = new dynamic[arr.Count];
var t = string.Empty;
for(var i = 0;i < arr.Count - 1; i++){
t += arr[i] + ",";
}
t += ar
...
继续阅读
(35)