N种可能组合的函数 [英] A Function of N Possible Combinations

查看:62
本文介绍了N种可能组合的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在申请,但被卡在一个模块中,

我只是想做一个像

I am making an application but i am stuck in one module,

i simply want to make a Method like

private string Hitter()
{
Some Code
}



它将返回以下所有可能的组合

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890〜!@#$%^& *()_ + =-`'';.,?/<>:"{} | \] [


有可能吗,我觉得会.... ~~

请指导我:confused:



which will return all possible combinations of the following

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*()_+=-`'';.,?/<>:"{}|\][


Is it Possible ?, I feel it will be....:~

Please Guide me:confused:

推荐答案

%^& *()_ + =-`'';; ,,?/<>:"{} | \] [


有可能吗,我觉得会.... ~~

请引导我:困惑:
%^&*()_+=-`'';.,?/<>:"{}|\][


Is it Possible ?, I feel it will be....:~

Please Guide me:confused:


这实际上是不可能的.或者,换句话说,可以编写这样的算法,但是当算法完成时,您(或者您的孙子)仍然活着的机会很小.

您有大约100个字符的集合.大约有10 ^ 28种50种组合(从10种^ 28种方法中选择100种中的50种).无论您的算法有多有效,生成10 ^ 28项数据都将花费很长时间.不是说所有49个组合,48个组合,47个组合...

也许您的意思是排列而不是组合.好吧,如果是这样,那么您的情况就不会再好了,因为大约有10 ^ 157个排列...好吧,我希望您对此有足够的耐心.
It is virtually impossible. Or, in other words, it is possible to write such algorithm, but you have a very slim chance that you (or your grand-grandsons) will still be alive when the algorithm finishes.

You have a set of approximately 100 characters. There are approximately 10^28 50-combinations (10^28 ways to choose 50 items out of 100). No matter how efficient your algorithm is, it will take forever to generate 10^28 items. Not speaking about all 49-combinations, 48-combinations, 47-combinations...

Maybe you meant permutations instead of combinations. Well, if that''s the case, then your situation is not any better, since there are about 10^157 permutations... Well, I wish you a lot of patience with that.


查看本文:

使用C#泛型的排列,组合和变体 [
Check this article:

Permutations, Combinations, and Variations using C# Generics[^]

Or google "c# permutations"


这篇关于N种可能组合的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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