求在C#从M个数中取N个的所有组合算法,无重复 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://topic.csdn.net/u/20090217/21/f41ed9f6-f929-451c-a5c9-80d2e408422a.html?56197 以前为了追求效率都是自己模拟栈,现在还是化繁为简,直接用递归了,代码简单using System;namespace ConsoleApplication4{ class Program { static string[] Items = new string[] { "A", "B", "C", "D", "E" }; static void Main(string[] args) { int selectCount = 2; Select(0, selectCount, string.Empty); } static void Select(int currentIndex, int remain, string currentSelect) { if (remain == 0) { Console.WriteLine(currentSelect); return; } if (Items.Length - currentIndex < remain) return; Select(currentIndex + 1, remain - 1, currentSelect + Items[currentIndex]); Select(currentIndex + 1, remain, currentSelect); } }} WPF浏览器应用程序问题(急,在线等) 给个能自动登录抓取登陆后网页,急求 关于验证码控件的问题 郁闷死了,csdn就没搞手能解决图片连接问题了吗 100分 郁闷在线等 C#邮件开发问题急急急急啊 跪求答案 怎样在程序中让DataGrid滚动到底部????????????? 返回函数那里错了?? 向Access中插入数据报错 .NET开发工具选择:Visio studio.net 还是C# Builder好些?请同行们指点 关于一个系统自定义菜单问题的讨论 以上补充程序: 一个VS2008中TFS的问题
using System;namespace ConsoleApplication4
{
class Program
{
static string[] Items = new string[] { "A", "B", "C", "D", "E" }; static void Main(string[] args)
{
int selectCount = 2;
Select(0, selectCount, string.Empty);
} static void Select(int currentIndex, int remain, string currentSelect)
{
if (remain == 0)
{
Console.WriteLine(currentSelect);
return;
} if (Items.Length - currentIndex < remain)
return; Select(currentIndex + 1, remain - 1, currentSelect + Items[currentIndex]);
Select(currentIndex + 1, remain, currentSelect);
}
}
}