如何选择所有可能的组合?组合、如何选择

2023-09-11 07:27:03 作者:从不低调@

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

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.