美文网首页
What is the Julia function to co

What is the Julia function to co

作者: 昵称违法 | 来源:发表于2021-03-29 21:05 被阅读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]
    

    相关文章

      网友评论

          本文标题:What is the Julia function to co

          本文链接:https://www.haomeiwen.com/subject/rblihltx.html