zoukankan
html css js c++ java
用c#进行递归组合
static
string
[] m_Data
=
{
"
A
"
,
"
B
"
,
"
C
"
,
"
D
"
,
"
E
"
}
;
static
void
Main(
string
[] args)
{
Dictionary
<
string
,
int
>
dic
=
new
Dictionary
<
string
,
int
>
();
for
(
int
i
=
0
; i
<
m_Data.Length; i
++
)
{
Console.WriteLine(m_Data[i]);
//
如果不需要打印单元素的组合,将此句注释掉
dic.Add(m_Data[i], i);
}
GetString(dic);
Console.ReadLine();
}
static
void
GetString(Dictionary
<
string
,
int
>
dd)
{
Dictionary
<
string
,
int
>
dic
=
new
Dictionary
<
string
,
int
>
();
foreach
(KeyValuePair
<
string
,
int
>
kv
in
dd)
{
for
(
int
i
=
kv.Value
+
1
; i
<
m_Data.Length; i
++
)
{
Console.WriteLine(kv.Key
+
m_Data[i]);
dic.Add(kv.Key
+
m_Data[i], i);
}
}
if
(dic.Count
>
0
) GetString(dic);
}
查看全文
相关阅读:
计算中文混合字符串长度(一)
PHP截取含中文的混合字符串长度的函数
获取星座的JS函数
获取生日对应星座的PHP函数
简单的 jQuery 浮动层随窗口滚动滑动插件实例
MD5算法实现
70. Climbing Stairs QuestionEditorial Solution
167. Two Sum II
167. Two Sum II
303. Range Sum Query
原文地址:https://www.cnblogs.com/szyicol/p/1393201.html
最新文章
leetcode -- Interleaving String
leetcode -- Search a 2D Matrix
leetcode -- Word Search
leetcode -- Remove Duplicates from Sorted Array II
leetcode -- Remove Duplicates from Sorted Array
ubuntu 12.04中环境变量设置
tomcat
各个线程顺序循环执行
java动态代理(JDK和cglib)
MySQL索引背后的数据结构及算法原理
热门文章
http长连接
Mysql索引
哈希一致性算法
websocket
AIO
java内存
ImageView.ScaleType设置图解
Android Duplicate files copied in APK
Zend Studio 无法打开的解决办法
计算中文混合字符串长度(二)
Copyright © 2011-2022 走看看