What is the Julia function to co

2021-03-29  本文已影响0人  昵称违法

从n个元素中取出k个的组合数量:

julia> binomial(2,1)
2

julia> binomial(3,2)
3

具体的组合明细:

julia> using Combinatorics

julia> collect(combinations(1:3,2))
3-element Array{Array{Int64,1},1}:
 [1, 2]
 [1, 3]
 [2, 3]
上一篇 下一篇

猜你喜欢

热点阅读