def countAllZhuShu(self, codes, wtype): wtype = int(wtype) #任选 if wtype in [249,250,251,252,253,254,255]: nneeds = wtype - 247 nchose = len(codes.split(',')) if nneeds > nchose: return 0 return Math.C(nchose,nneeds) #直选 # if wtype == 244: # return len(codes.split(',')) if wtype in [244,245,246]: chose = codes.split('|') chose[0] = chose[0].split(',') if chose[0]!='-' else ['-1'] chose[1] = chose[1].split(',') if chose[1]!='-' else ['-1'] chose[2] = chose[2].split(',') if chose[2]!='-' else ['-1'] zhushu = 0 for a in chose[0]: for b in chose[1]: for c in chose[2]: if a==b and a!='-1':continue if b==c and b!='-1':continue if c==a and c!='-1':continue zhushu+= 1 return zhushu #组选 if wtype in [247,248]: nneeds = wtype - 245 nchose = len(codes.split(',')) if nneeds > nchose: return 0 return Math.C(nchose,nneeds)
def countAllZhuShu(self, codes, wtype): wtype = int(wtype) zhushu = 0 # 排三排五七星彩直选 if wtype in [415, 394, 391]: position = codes.split('|') zhushu = len(position[0]) for i in range(1, len(position)): zhushu *= len(position[i]) # 排三组选三 if wtype in [420]: nneeds = 2 nchose = len(codes.split(',')) if nneeds > nchose: return 0 zhushu = Math.C(nchose, nneeds) * 2 # 排三组选六 if wtype in [425]: nneeds = 3 nchose = len(codes.split(',')) if nneeds > nchose: return 0 zhushu = Math.C(nchose, nneeds) return zhushu