Chinaunix

标题: 大神, 怎么实现? [打印本页]

作者: lxb456811    时间: 2012-09-27 09:52
标题: 大神, 怎么实现?
Math::Combinatorics貌似不行
%Modif = {‘A’=>1, ‘B’=>2, ‘C’=>3}
output
If $comb_num = 1:
                 enumerate all possible combinations, save in the %combinationhash
                %combinationhash = {‘A’=>1, ‘B’=>2,’C’=>3}
If $comb_num = 2:
        %combinationhash = {‘A’=>1, ‘B’=>2,’C’=>3, ’AB’=>3, ‘AC’=>4, ‘BC’=>5, ‘AA’=2, ‘BB’ = 4, ‘CC’=6}

作者: zhlong8    时间: 2012-09-27 10:07
大神,能得到排列求个和都不会?别这么死脑筋啊

另外 %Modif = ('A'=>1, 'B'=>2, 'C'=>3);
作者: lxb456811    时间: 2012-09-27 10:48
回复 2# zhlong8


    这个排列有AA,BB,CC这样的?  
    它不取重复啊,大哥。
作者: zhlong8    时间: 2012-09-27 11:12
回复 3# lxb456811


    大神那里不是有个 multiset 方法吗?设置下 frequency 就可以了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2