如何选择所有可能的组合? [英] How to choose all possible combinations?

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

问题描述

让我们假设我们有贷款的用户名单已经象下面这样:

Let's assume that we have the list of loans user has like below:

  • loan1
  • loan2
  • loan3
  • ...
  • loan10

和我们具有可以接受的2至10贷款功能: 函数(贷款)。 对于前,以下是可能的:

And we have the function which can accept from 2 to 10 loans: function(loans). For ex., the following is possible:

  • 函数(loan1,loan2)
  • 函数(loan1,loan3)
  • 函数(loan1,loan4)
  • 函数(loan1,loan2,loan3)
  • 函数(loan1,loan2,loan4)
  • 函数(loan1,loan2,loan3,loan4,loan5,loan6,loan7,loan8,loan9,loan10)
  • function(loan1, loan2)
  • function(loan1, loan3)
  • function(loan1, loan4)
  • function(loan1, loan2, loan3)
  • function(loan1, loan2, loan4)
  • function(loan1, loan2, loan3, loan4, loan5, loan6, loan7, loan8, loan9, loan10)

如何写code通过所有可能的组合,以该功能?

How to write the code to pass all possible combinations to that function?

推荐答案

罗塞塔code 您已经实现产生的组合在许多语言中,选择你自己。

On RosettaCode you have implemented generating combinations in many languages, choose yourself.

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

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