进来了 ^_^
快,先请坐.. 呵呵... 问题是关于双色球的小程序:
 先说一下偶的想法,俺想如果随机生成大量的定长字串,并统计出字串在已开奖的历史中出号数量的max值,然后设条件0-max=定长字串作条件过滤,会不会是条是个好的玩彩方法呢?
 举例说明一下:
 如随机生成的一条定长字串:04 30 10 03 31 08 15 02 05 27 20
 期    号       开奖号码                定长字串中奖数量
 2003001  10 11 12 13 26 28           1 (10)
 2003002  04 09 19 20 21 26           2 (04,20)
 2003003  01 07 10 23 28 32           1 (10)
 2003004  04 06 07 10 13 25           2 (04,10)
 2003005  04 06 15 17 30 31           4 (04,15,30,31)
 ...                                  ... 
 2008043  03 04 09 11 12 24           2(03,04)
 
 经统计,这个定长字串在所有的开奖历史中的出号数量的MAX值=5 所以设条件:0-5=04 30 10 03 31 08 15 02 05 27 20,在过滤软件中这一个条件可以过滤掉462注,别看少,但可以积少成多,一般每个文本用5千注,20个这个的文本过滤的数量就很可观了,而且由于随机字串是无限生成的,数据源是无穷无尽的,所以估计能有前途(我也没全面测试过,程序太慢,偶受不了,呵呵)

解决方案 »

  1.   

    供测试的代码如下:Option ExplicitSub lcmax()'极值条件Dim i As Integer, j As Integer, k As Integer, dt As IntegerDim tp As Integer, kp As Integer, np As Integer
    Dim kjh(1 To 300) As String  '开奖号码Dim strt(1 To 300) As String  '待与开奖号比较的随机字串Dim ntw() As IntegerDim imax(1 To 300) As Integer   '1000个比较字串的ma值数组Dim sg As String, tem As StringDim splits As StringDim js As Long   '有效条件计数变量
      

  2.   

    '开奖号码
    kjh(1) = "10 11 12 13 26 28"
    kjh(2) = "04 09 19 20 21 26"
    kjh(3) = "01 07 10 23 28 32"
    kjh(4) = "04 06 07 10 13 25"
    kjh(5) = "04 06 15 17 30 31"
    kjh(6) = "01 03 10 21 26 27"
    kjh(7) = "01 09 19 21 23 26"
    kjh(8) = "05 08 09 14 17 23"
    kjh(9) = "05 09 18 20 22 30"
    kjh(10) = "01 02 08 13 17 24"
    kjh(11) = "04 05 11 12 30 32"
    kjh(12) = "02 12 16 17 27 30"
    kjh(13) = "08 13 17 21 23 32"
    kjh(14) = "03 05 07 08 21 31"
    kjh(15) = "04 11 19 25 26 32"
    kjh(16) = "11 17 28 30 31 33"
    kjh(17) = "05 08 18 23 25 31"
    kjh(18) = "05 16 19 20 25 28"
    kjh(19) = "04 08 12 13 16 33"
    kjh(20) = "07 10 25 26 27 32"
    kjh(21) = "14 15 18 25 26 30"
    kjh(22) = "02 07 11 12 14 32"
    kjh(23) = "01 10 20 22 26 31"
    kjh(24) = "02 07 15 17 22 30"
    kjh(25) = "01 05 11 13 14 27"
    kjh(26) = "08 13 15 26 29 31"
    kjh(27) = "01 11 14 17 27 28"
    kjh(28) = "06 13 16 20 28 32"
    kjh(29) = "02 07 15 26 29 32"
    kjh(30) = "02 06 13 14 23 27"
    kjh(31) = "11 17 20 22 28 32"
    kjh(32) = "04 11 25 27 29 30"
    kjh(33) = "01 07 14 20 27 30"
    kjh(34) = "08 13 14 16 23 25"
    kjh(35) = "03 04 05 08 10 11"
    kjh(36) = "07 21 24 25 27 28"
    kjh(37) = "09 14 17 18 26 32"
    kjh(38) = "05 07 08 24 25 27"
    kjh(39) = "03 05 23 24 27 32"
    kjh(40) = "04 05 06 12 14 23"
    kjh(41) = "02 03 17 18 24 25"
    kjh(42) = "03 05 07 10 15 20"
    kjh(43) = "02 08 10 19 20 32"
    kjh(44) = "02 05 09 16 32 33"
    kjh(45) = "03 07 14 15 17 32"
    kjh(46) = "07 08 10 11 17 26"
    kjh(47) = "03 17 26 28 32 33"
    kjh(48) = "10 12 20 28 30 31"
    kjh(49) = "03 06 07 13 24 25"
    kjh(50) = "02 08 17 23 24 26"
    kjh(51) = "04 13 15 17 24 27"
    kjh(52) = "01 12 13 23 30 31"
    kjh(53) = "15 19 20 21 28 29"
    kjh(54) = "02 05 09 21 31 33"
    kjh(55) = "06 13 16 21 28 31"
    kjh(56) = "08 17 21 26 28 29"
    kjh(57) = "18 19 24 25 30 31"
    kjh(58) = "09 11 16 28 32 33"
    kjh(59) = "02 03 05 06 18 30"
    kjh(60) = "02 04 06 17 21 28"
    kjh(61) = "03 05 20 21 28 32"
    kjh(62) = "01 06 12 19 20 32"
    kjh(63) = "05 08 09 14 21 33"
    kjh(64) = "04 06 08 12 15 30"
    kjh(65) = "06 15 16 17 30 33"
    kjh(66) = "03 07 08 20 24 32"
    kjh(67) = "05 11 12 13 27 31"
    kjh(68) = "09 19 25 27 32 33"
    kjh(69) = "07 11 16 19 26 28"
    kjh(70) = "01 02 04 17 18 19"
    kjh(71) = "09 11 12 14 15 33"
    kjh(72) = "03 06 08 11 19 27"
    kjh(73) = "02 12 14 21 23 30"
    kjh(74) = "02 12 19 22 27 32"
    kjh(75) = "16 17 19 22 31 33"
    kjh(76) = "01 13 16 18 20 29"
    kjh(77) = "04 12 16 22 24 25"
    kjh(78) = "07 12 23 26 29 30"
    kjh(79) = "12 15 22 23 26 31"
    kjh(80) = "09 20 24 25 28 30"
    kjh(81) = "01 02 14 26 29 30"
    kjh(82) = "07 17 18 19 30 31"
    kjh(83) = "01 03 14 18 26 28"
    kjh(84) = "02 06 07 10 17 33"
    kjh(85) = "01 04 11 12 19 27"
    kjh(86) = "05 12 16 18 26 30"
    kjh(87) = "02 03 04 05 24 28"
    kjh(88) = "03 10 21 22 24 33"
    kjh(89) = "18 19 21 26 27 33"
    kjh(90) = "01 02 03 07 10 25"
    kjh(91) = "10 12 18 22 30 31"
    kjh(92) = "03 05 06 17 26 33"
    kjh(93) = "10 19 22 23 25 29"
    kjh(94) = "09 11 13 16 17 18"
    kjh(95) = "04 12 18 20 23 32"
    kjh(96) = "04 12 17 20 25 28"
    kjh(97) = "01 07 10 22 32 33"
    kjh(98) = "01 09 10 16 22 24"
    kjh(99) = "06 07 08 13 14 19"
    kjh(100) = "01 04 13 23 28 30"
    kjh(101) = "01 07 27 30 31 33"
    kjh(102) = "12 14 21 29 30 32"
    kjh(103) = "03 07 11 17 20 26"
    kjh(104) = "01 03 05 18 22 23"
    kjh(105) = "04 07 08 28 30 32"
    kjh(106) = "05 12 14 15 25 31"
    kjh(107) = "02 05 06 08 28 30"
    kjh(108) = "05 10 11 23 24 32"
    kjh(109) = "01 02 09 22 28 31"
    kjh(110) = "05 09 11 17 26 27"
    kjh(111) = "03 10 14 19 20 30"
    kjh(112) = "01 08 14 17 19 30"
    kjh(113) = "01 13 21 23 25 32"
    kjh(114) = "07 08 10 24 29 33"
    kjh(115) = "04 10 14 18 28 32"
    kjh(116) = "01 05 09 10 18 32"
    kjh(117) = "01 02 03 05 10 22"
    kjh(118) = "09 13 20 22 24 32"
    kjh(119) = "01 07 09 17 26 31"
    kjh(120) = "03 06 19 20 21 24"
    kjh(121) = "02 05 08 11 15 31"
    kjh(122) = "01 04 08 09 19 20"
    kjh(123) = "02 07 13 20 27 30"
    kjh(124) = "02 08 26 27 30 32"
    kjh(125) = "02 13 17 18 26 30"
    kjh(126) = "03 04 11 17 20 26"
    kjh(127) = "11 16 17 25 28 29"
    kjh(128) = "10 16 18 25 26 29"
    kjh(129) = "07 17 19 20 21 29"
    kjh(130) = "08 10 17 22 25 29"
    kjh(131) = "06 10 13 17 18 21"
    kjh(132) = "04 09 10 21 22 24"
    kjh(133) = "02 06 07 12 31 32"
    kjh(134) = "01 12 18 26 27 28"
    kjh(135) = "07 15 16 22 23 32"
    kjh(136) = "01 07 08 11 27 31"
    kjh(137) = "08 09 11 16 17 29"
    kjh(138) = "11 12 14 16 25 29"
    kjh(139) = "06 07 19 21 25 29"
    kjh(140) = "02 03 09 10 15 29"
    kjh(141) = "01 12 14 15 17 29"
    kjh(142) = "02 03 04 09 24 25"
    kjh(143) = "09 11 14 16 27 28"
    kjh(144) = "06 08 19 25 29 32"
    kjh(145) = "01 20 21 25 29 30"
    kjh(146) = "05 21 23 25 28 32"
    kjh(147) = "01 08 11 12 27 31"
    kjh(148) = "04 07 11 19 23 26"
    kjh(149) = "03 05 11 24 27 28"
    kjh(150) = "13 16 19 20 23 33"
    kjh(151) = "01 12 25 27 28 29"
    kjh(152) = "07 10 13 16 27 28"
    kjh(153) = "14 15 18 20 27 31"
    kjh(154) = "13 14 27 29 32 33"
    kjh(155) = "05 13 20 23 24 25"
    kjh(156) = "01 06 07 13 16 32"
    kjh(157) = "02 08 11 13 24 31"
    kjh(158) = "02 11 15 20 22 29"
    kjh(159) = "10 12 21 22 30 33"
    kjh(160) = "03 08 16 17 21 29"
    kjh(161) = "08 15 18 28 30 33"
    kjh(162) = "02 07 13 16 23 28"
    kjh(163) = "05 06 15 19 26 29"
    kjh(164) = "07 18 21 26 27 28"
    kjh(165) = "03 05 13 17 25 31"
    kjh(166) = "08 09 10 14 16 26"
    kjh(167) = "04 05 10 21 24 26"
    kjh(168) = "07 13 14 17 19 30"
    kjh(169) = "03 08 20 23 24 26"
    kjh(170) = "03 05 21 24 27 32"
    kjh(171) = "03 20 24 27 29 30"
    kjh(172) = "14 16 27 28 30 33"
    kjh(173) = "01 04 08 11 21 25"
    kjh(174) = "03 08 11 29 30 32"
    kjh(175) = "10 13 18 19 25 27"
    kjh(176) = "01 03 07 08 25 26"
    kjh(177) = "02 10 19 22 24 32"
    kjh(178) = "14 17 20 25 28 30"
    kjh(179) = "01 18 20 24 32 33"
    kjh(180) = "09 13 14 21 30 33"
    kjh(181) = "01 04 08 13 28 31"
    kjh(182) = "11 14 20 27 32 33"
    kjh(183) = "05 09 10 13 24 25"
    kjh(184) = "19 22 27 28 30 32"
    kjh(185) = "01 04 12 16 20 30"
    kjh(186) = "10 19 20 26 29 31"
    kjh(187) = "03 12 13 25 26 31"
    kjh(188) = "05 10 21 22 26 33"
    kjh(189) = "06 08 09 14 24 33"
    kjh(190) = "02 09 14 19 25 26"
    kjh(191) = "03 09 12 15 28 32"
    kjh(192) = "02 03 05 09 16 21"
    kjh(193) = "07 11 17 18 24 29"
    kjh(194) = "07 09 10 21 23 30"
    kjh(195) = "10 15 23 26 28 29"
    kjh(196) = "01 08 12 13 18 20"
    kjh(197) = "08 13 14 27 28 31"
    kjh(198) = "06 08 10 17 30 31"
    kjh(199) = "14 19 20 21 22 31"
    kjh(200) = "11 16 18 20 26 31"
      

  3.   

    '比较字串(举例 150个)strt(1) = "04 30 10 03 31 08 15 02 05 27 20"
    strt(2) = "03 17 25 01 22 33 24 27 10 04 02"
    strt(3) = "30 09 06 21 02 18 23 19 27 29 05"
    strt(4) = "19 20 26 32 28 12 23 02 14 27 22"
    strt(5) = "18 05 11 12 10 15 03 32 04 25 31"
    strt(6) = "31 08 10 13 06 23 32 27 17 04 07"
    strt(7) = "20 05 09 18 25 03 13 06 30 15 28"
    strt(8) = "26 11 33 10 01 05 21 06 14 09 22"
    strt(9) = "17 32 12 28 22 20 27 05 14 29 19"
    strt(10) = "27 09 06 24 26 13 25 30 01 29 15"
    strt(11) = "21 22 19 24 04 09 13 33 08 07 18"
    strt(12) = "21 23 16 33 08 04 28 15 18 30 13"
    strt(13) = "19 28 25 13 22 05 06 24 30 03 20"
    strt(14) = "01 21 04 15 31 16 23 18 30 19 33"
    strt(15) = "23 30 01 31 06 16 25 29 32 04 18"
    strt(16) = "16 02 04 25 29 08 13 06 26 23 22"
    strt(17) = "22 25 15 19 24 02 18 17 30 21 26"
    strt(18) = "19 01 21 07 06 28 20 33 26 18 30"
    strt(19) = "03 25 24 16 17 01 07 14 32 12 31"
    strt(20) = "14 25 33 24 22 18 31 28 08 01 06"
    strt(21) = "11 08 17 27 28 07 09 16 31 19 03"
    strt(22) = "14 01 06 19 24 17 04 33 32 31 03"
    strt(23) = "26 21 27 11 30 18 31 33 01 25 09"
    strt(24) = "30 16 06 04 29 10 03 31 08 15 02"
    strt(25) = "02 27 18 03 17 25 01 22 33 24 28"
    strt(26) = "10 03 01 30 11 08 23 04 20 24 19"
    strt(27) = "26 29 05 18 19 25 32 27 12 22 02"
    strt(28) = "16 28 24 17 04 10 11 09 14 03 32"
    strt(29) = "03 23 31 30 08 11 13 06 22 32 26"
    strt(30) = "17 06 08 21 05 10 19 26 03 14 04"
    strt(31) = "29 13 27 25 10 33 09 01 04 20 05"
    strt(32) = "11 07 20 18 32 13 28 23 21 29 04"
    strt(33) = "15 29 21 27 08 05 24 25 12 26 31"
    strt(34) = "02 28 15 21 22 19 24 05 09 13 33"
    strt(35) = "08 09 19 22 24 16 33 10 04 28 15"
    strt(36) = "18 31 15 19 27 25 12 22 05 06 23"
    strt(37) = "29 04 21 01 22 05 15 32 14 23 18"
    strt(38) = "30 18 33 22 28 01 31 06 15 24 29"
    strt(39) = "32 04 19 16 02 05 25 28 08 13 07"
    strt(40) = "26 22 23 20 25 13 17 24 02 16 15"
    strt(41) = "29 22 24 17 01 19 06 05 27 18 33"
    strt(42) = "26 20 29 03 24 23 15 14 01 07 13"
    strt(43) = "32 11 31 14 24 33 23 21 17 29 27"
    strt(44) = "11 01 08 13 10 19 28 29 07 12 18"
    strt(45) = "30 17 03 13 01 07 19 24 16 04 33"
    strt(46) = "33 31 02 25 20 24 11 28 17 29 32"
    strt(47) = "01 29 12 31 17 07 04 30 11 05 32"
    strt(48) = "07 14 02 03 28 20 04 18 26 01 24"
    strt(49) = "33 23 26 09 02 01 30 10 07 21 04"
    strt(50) = "18 22 19 27 29 04 16 17 25 32 28"
    strt(51) = "14 24 03 16 29 25 17 05 10 11 09"
    strt(52) = "13 03 32 04 23 30 29 08 11 14 07"
    strt(53) = "22 32 27 16 05 07 20 04 09 18 25"
    strt(54) = "04 13 05 29 14 27 26 11 33 10 01"
    strt(55) = "04 21 05 12 09 20 18 32 14 29 24"
    strt(56) = "21 28 06 15 30 20 26 08 05 24 25"
    strt(57) = "13 26 30 02 28 15 20 21 18 23 05"
    strt(58) = "09 15 33 08 07 19 22 24 17 32 10"
    strt(59) = "05 28 16 18 31 15 19 27 24 12 22"
    strt(60) = "06 07 24 29 03 21 01 22 05 16 32"
    strt(61) = "15 22 18 30 19 33 23 29 01 31 05"
    strt(62) = "16 26 31 32 04 19 14 02 05 23 28"
    strt(63) = "07 13 05 26 23 22 21 27 15 19 25"
    strt(64) = "02 19 18 29 23 24 16 01 20 07 06"
    strt(65) = "27 19 32 25 18 29 02 23 22 13 14"
    strt(66) = "01 07 15 32 12 31 14 25 33 23 22"
    strt(67) = "20 31 29 10 01 07 12 09 17 27 26"
    strt(68) = "08 10 16 30 19 03 14 01 06 21 25"
    strt(69) = "16 03 33 32 30 02 24 20 25 11 28"
    strt(70) = "20 30 33 01 28 11 29 15 06 04 27"
    strt(71) = "10 04 31 07 15 02 03 27 20 05 19"
    strt(72) = "25 01 22 33 23 27 09 03 02 30 10"
    strt(73) = "07 22 02 18 23 19 28 30 05 17 20"
    strt(74) = "25 32 28 13 22 03 15 27 23 16 04"
    strt(75) = "10 11 09 15 03 32 04 24 31 29 08"
    strt(76) = "10 12 06 23 32 27 17 05 08 21 04"
    strt(77) = "08 18 24 04 13 05 30 14 28 26 11"
    strt(78) = "32 10 02 05 21 06 13 09 22 19 31"
    strt(79) = "13 28 23 20 29 05 15 30 19 26 08"
    strt(80) = "06 25 26 13 27 30 02 28 15 19 20"
    strt(81) = "20 24 05 10 14 33 08 07 19 22 25"
    strt(82) = "17 33 09 04 27 16 19 30 14 20 26"
    strt(83) = "25 14 23 06 05 24 30 03 21 01 20"
    strt(84) = "03 15 31 14 22 18 29 19 33 23 28"
    strt(85) = "01 31 06 17 26 30 32 05 19 15 03"
    strt(86) = "03 24 28 07 13 06 26 22 21 20 27"
    strt(87) = "15 20 25 02 19 18 29 23 24 16 01"
    strt(88) = "20 06 05 27 19 33 26 18 29 02 23"
    strt(89) = "25 16 17 01 07 14 32 11 31 13 26"
    strt(90) = "33 24 22 18 31 28 09 01 07 11 08"
    strt(91) = "16 27 28 07 09 15 31 18 03 13 01"
    strt(92) = "05 18 23 16 03 33 32 31 02 25 20"
    strt(93) = "26 12 30 19 31 33 01 27 10 28 15"
    strt(94) = "07 04 30 11 03 31 09 16 02 05 27"
    strt(95) = "18 03 17 26 01 23 33 24 27 10 04"
    strt(96) = "01 30 09 07 22 03 19 23 20 27 29"
    strt(97) = "05 19 20 26 32 28 13 23 02 15 29"
    strt(98) = "24 17 04 11 12 09 15 03 32 05 25"
    strt(99) = "31 30 07 10 12 06 22 32 26 17 04"
    strt(100) = "07 21 05 10 18 25 03 14 04 30 15"
    strt(101) = "27 26 11 33 09 01 05 20 04 13 08"
    strt(102) = "19 17 32 12 28 23 20 27 05 13 29"
    strt(103) = "21 27 09 05 25 26 13 28 31 01 29"
    strt(104) = "15 21 22 19 25 04 09 13 33 07 08"
    strt(105) = "18 21 23 15 33 08 04 28 14 17 31"
    strt(106) = "16 19 28 25 13 23 05 06 24 30 03"
    strt(107) = "22 01 21 04 15 31 14 23 18 30 17"
    strt(108) = "33 22 29 01 30 06 16 24 28 31 04"
    strt(109) = "20 16 02 04 25 29 08 13 06 27 23"
    strt(110) = "23 21 26 14 18 25 02 17 16 30 22"
    strt(111) = "24 18 01 20 07 05 28 19 33 26 17"
    strt(112) = "29 03 24 23 16 15 01 07 14 33 11"
    strt(113) = "31 13 25 33 23 21 17 30 27 08 01"
    strt(114) = "07 12 09 18 28 27 08 10 16 31 20"
    strt(115) = "04 14 01 07 19 24 17 03 33 32 31"
    strt(116) = "02 26 21 27 12 30 19 31 33 01 25"
    strt(117) = "12 30 17 06 04 29 10 03 31 08 15"
    strt(118) = "02 03 27 19 04 17 25 01 23 33 24"
    strt(119) = "27 10 03 01 31 11 08 22 04 19 23"
    strt(120) = "19 27 29 05 17 20 25 32 28 11 22"
    strt(121) = "03 16 28 24 18 05 11 12 09 15 02"
    strt(122) = "32 03 22 30 29 08 10 12 06 21 31"
    strt(123) = "27 17 05 08 21 06 10 19 25 03 14"
    strt(124) = "04 29 13 27 25 11 33 09 01 05 21"
    strt(125) = "04 12 08 21 18 32 13 28 24 20 29"
    strt(126) = "06 16 29 21 27 09 05 24 26 13 25"
    strt(127) = "30 02 27 15 20 21 19 23 05 09 13"
    strt(128) = "33 08 07 19 21 23 16 32 09 04 27"
    strt(129) = "16 18 31 14 20 27 25 11 23 05 04"
    strt(130) = "23 29 04 21 01 20 05 15 32 14 22"
    strt(131) = "18 30 19 33 22 28 01 31 05 14 24"
    strt(132) = "31 32 04 19 15 02 05 24 27 08 13"
    strt(133) = "05 26 22 23 20 25 14 18 27 01 16"
    strt(134) = "18 29 22 24 16 01 19 06 05 28 20"
    strt(135) = "32 25 19 29 03 23 22 14 15 01 07"
    strt(136) = "14 32 11 31 13 24 33 23 21 17 29"
    strt(137) = "29 11 01 08 13 09 18 27 28 07 10"
    strt(138) = "15 30 18 03 13 01 06 20 24 17 04"
    strt(139) = "33 32 30 02 24 19 23 11 27 17 28"
    strt(140) = "33 01 28 12 30 16 07 04 29 10 05"
    strt(141) = "31 06 13 02 03 27 19 04 18 25 01"
    strt(142) = "22 33 24 26 09 02 01 30 10 07 20"
    strt(143) = "02 18 22 19 27 29 05 17 20 26 32"
    strt(144) = "28 14 24 03 16 29 23 17 05 10 11"
    strt(145) = "10 14 03 32 04 23 30 29 08 11 13"
    strt(146) = "07 23 32 27 16 05 08 20 04 10 18"
    strt(147) = "24 04 13 05 29 14 27 26 11 33 10"
    strt(148) = "02 05 21 06 13 10 22 19 32 14 29"
    strt(149) = "23 20 28 05 15 30 19 26 08 04 24"
    strt(150) = "26 13 27 30 02 28 14 20 19 18 22"
      

  4.   

    '&&&&&&&&&&&&&&&&&&&&&&  '统计
      
     ReDim imax(1 To 200)
     
     For tp = 1 To 150   '150个比较字串循环判断
     
      ReDim ntw(1 To 200)
     
       For i = 1 To 200   '开奖期数(在上期为止,实际为713期)
       
          dt = 0
       
          For j = 1 To Len(kjh(i)) Step 3
         
            If InStr(strt(tp), Mid(kjh(i), j, 2)) > 0 Then dt = dt + 1
           
          Next j
         
          ntw(i) = dt
         
        Next i
        
        imax(tp) = Application.Max(ntw)   '求出imax()数组的最大值,即当前比较字串在所有的开奖历史中,出奖号的数量的最大数
     
      Next tp
      
      
          '写入过滤文本
      
          filenum = FreeFile
          
          Open App.Path & "\过滤条件.txt" For Output As #1
          
          
           For np = 1 To 150
           
              If imax(np) < 6 Then Print #1, Spc(0); "0-" & imax(np) & "=" & strt(np) & ",": js = js + 1
            
           Next np
           
           Print #1, Spc(0); "有效条件数量:"; js
           
          Close #1  
      MsgBox "ok!", vbInformation, "提示"
    End Sub
      

  5.   

    本来准备的所有的713期开奖数据,与1000个字串的比较程序源码,但帖子发不出来,说是字数超范围了
    没办法,只好截取了一部分数据,但这样变量定义就有问题了,更正一下:Dim i As Integer, j As Integer, k As Integer, dt As Integer Dim tp As Integer, kp As Integer, np As Integer 
    Dim kjh(1 To 200)As String  '开奖号码 Dim strt(1 To 150) As String  '待与开奖号比较的随机字串 Dim ntw() As Integer Dim imax(1 To 150) As Integer   '150个比较字串的ma值数组 Dim sg As String, tem As String Dim splits As String Dim js As Long   '有效条件计数变量 
      

  6.   

     '统计 
       
     ReDim imax(1 To 150) 
      
     For tp = 1 To 150   '150个比较字串循环判断 
      
      ReDim ntw(1 To 200) 
      
       For i = 1 To 200   '开奖期数(在上期为止,实际为713期) 
        
          dt = 0 
        
          For j = 1 To Len(kjh(i)) Step 3 
          
            If InStr(strt(tp), Mid(kjh(i), j, 2)) > 0 Then dt = dt + 1 
            
          Next j 
          
          ntw(i) = dt 
          
        Next i 
         
        imax(tp) = Application.Max(ntw)   '求出imax()数组的最大值,即当前比较字串在所有的开奖历史中,出奖号的数量的最大数 
      
      Next tp 
       
       
          '写入过滤文本 
       
          filenum = FreeFile 
           
          Open App.Path & "\过滤条件.txt" For Output As #1 
           
           
           For np = 1 To 150 
            
              If imax(np)  < 6 Then Print #1, Spc(0); "0-" & imax(np) & "=" & strt(np) & ",": js = js + 1 
             
           Next np 
            
           Print #1, Spc(0); "有效条件数量:"; js 
            
          Close #1    
      MsgBox "ok!", vbInformation, "提示" 
    End Sub 
      

  7.   

    谢谢alifriend朋友,但变成数字后,是这样的循环判断以定长字串为11的为例:  for i=1 to 11   for j=1 to 6   ...   next j  next i 这样的循环,速度估计也不会快 
      

  8.   

    可能是帖子发乱了,上面的只要kjh(1 to 200) 与 strt(1 to 150) 这两个字串数组的数据,其他的以下面为准:供测试的代码如下: Option Explicit Sub lcmax() '极值条件 Dim i As Integer, j As Integer, k As Integer, dt As Integer Dim tp As Integer, kp As Integer, np As Integer 
    Dim kjh(1 To 200) As String  '开奖号码 Dim strt(1 To 150) As String  '待与开奖号比较的随机字串 Dim ntw() As Integer Dim imax(1 To 150) As Integer   '150个比较字串的ma值数组 Dim sg As String, tem As String Dim splits As String Dim js As Long   '有效条件计数变量 kjh(1) = "10 11 12 13 26 28"
    ...
    kjh(200) = "11 16 18 20 26 31"'kjh()的所有具体数据在上面帖子取
    strt(1) = "04 30 10 03 31 08 15 02 05 27 20" 
    ...
    strt(150) = "26 13 27 30 02 28 14 20 19 18 22" 'strt()的所有具体数据在上面帖子取
    '统计  
        
     ReDim imax(1 To 150)  
       
     For tp = 1 To 150   '150个比较字串循环判断  
       
      ReDim ntw(1 To 200)  
       
       For i = 1 To 200   '开奖期数(在上期为止,实际为713期)  
         
          dt = 0  
         
          For j = 1 To Len(kjh(i)) Step 3  
           
            If InStr(strt(tp), Mid(kjh(i), j, 2)) > 0 Then dt = dt + 1  
             
          Next j  
           
          ntw(i) = dt  
           
        Next i  
          
        imax(tp) = Application.Max(ntw)   '求出imax()数组的最大值,即当前比较字串在所有的开奖历史中,出奖号的数量的最大数  
       
      Next tp  
        
        
          '写入过滤文本  
        
          filenum = FreeFile  
            
          Open App.Path & "\过滤条件.txt" For Output As #1  
            
            
           For np = 1 To 150  
             
              If imax(np)   < 6 Then Print #1, Spc(0); "0-" & imax(np) & "=" & strt(np) & ",": js = js + 1  
              
           Next np  
             
           Print #1, Spc(0); "有效条件数量:"; js  
             
          Close #1      
      MsgBox "ok!", vbInformation, "提示"  
    End Sub 
      

  9.   

    strt(1) = "04 30 10 03 31 08 15 02 05 27 20" 
    ......
    先转换成Long类型的数组arrNum&(),然后从小到大排序。Dim iTest&
    for i=1 to NumEnd   '最后期号
        dt = 0
        for j=1 to 6
            iTest = kjh(i, j)
            for k=1 to 11
                if (iText = arrNum(k)) then
                    dt = dt+1
                    exit for
                endif
                if (iTest < arrNum(k)) then Exit for    '这样就减少循环次数
            next
        next
        ntw(i) = dt
    next
    ====================大概思路就是这样的。
      

  10.   

    为什么要这样?试试把那个11长字串变为一个22伟的大整数,再进一步,把你每期开奖的7个数也变成一个14位的大整数,然后用数学方式比较。
    虽然我还是不太明白楼主的思路,想法,例如根据楼主给出来的数据,为什么会得出“这个定长字串在所有的开奖历史中的出号数量的MAX值=5”的结论????不过,要提高速度,使用数值运算是比较合理的方向。。
      

  11.   

    就以你上面的数据举一个简单的例子吧:“如随机生成的一条定长字串:14 30 10 03 31 08 15 02 05 27 20 
     期    号       开奖号码                 
     2003001  10 11 12 13 26 28  ”          dim a as long
    dim b as long
    dim c as long 
    dim d as long
    a=1430100331081502052720'在实际的编程中,vb也许处理不了这么大的数据,但这也是很容易解决的。
    b=101112132628’注释同上
    for i=1 to 7
    for j=1 to 6
    if i=1 then 
    c=(a mod 100)
    else
    c=(a mod 100^i)-(a mod 100^(i-1))
    endif
    if j=1 then 
    d=(b mod 100)
    else
    d=(b mod 100^j)-(b mod 100^(i-1))
    endif
    if c=d then
    'match,做你要做的
    endif
    next
    next'随手写的,必然有很多语法上的错漏,但意思大致如此。
      

  12.   

    晕,上面的for i=1 to 7更正为for i=1 to 11其他的错误看着改吧另外说说几点。
      

  13.   

    回LS:  (先假设VB能够处理这么大的整数)你在27楼的代码能够高效运行吗?你的“比较过程”中频繁地求乘幂、求余,你考虑过这些运算是否耗时没有?
      反正我觉得这样的代码很不可取!
      

  14.   

    1.在你上面给出的数据中,我留意到kjh()数组里的数据似乎都是已经过排序的,那么,如果用我的方法比较次数也许还可以少一点,方法是先将随机数列排序,如果min(strt())>max(kjh())或max(strt())<min(kjh())那这一轮的循环就没必要了。
    2.留意到你用了If InStr(strt(tp), Mid(kjh(i), j, 2)) > 0 Then dt = dt + 1,在这里,就不说mid的慢了,看看instr,在这里,由于你的数据格式,它真正比较的次数并不是1次,也不是11次,而是len(strt(tp))-1这么多次,这有什么办法不慢?
    3.彩票适可而止,没听说过到赌场赌钱赢钱的一般都是不会赌钱的人?不是说赌客都不懂概论,而是庄家在这方面下的功夫总会比赌客多,除了少数由于游戏规则(如21点)的关系,赌客可靠很好的记忆力赢到钱以外,其他的一般的分析都帮助不大。。这就当一个脑力游戏玩玩算了吧。
      

  15.   

    to chen8013:
    按你方法修改后,速度确实有了很大的提升在相同的条件下:(20个数据文本,每个数据文本有数据5000条)经测试:原程序用时4分13秒
    新程序用时1分12秒用时缩至原来的1/4左右...已经是很不错了但我想把用时缩至1分种之内,在网上查了一下资料,有资料说用byt类型数组进行字串比较可以提速,不知是否可以用到我的这个小程序里(我不知从何下手,呵呵),请百忙之中再指点一下,盼~
      

  16.   

    TO lsftest:
    谢谢参与并提供参与代码,我抽空测试一下...
      

  17.   

    '读取数据
    Private Sub Command3_Click()
        Dim s As String
        Dim i As Long
        Dim j As Long
        
        
        i = 0
        
        Open filename For Input As #1
        Do
            Line Input #1, s
            s = Trim(s)
            If Len(s) Then
                i = i + 1
                For j = 1 To 7
                    thedata(i, j) = Val(Mid$(s, (j - 1) * 2 + 1, 2))
                Next j
            End If
        Loop While Not EOF(1)
        Close #1
        datacount = i
    End Sub'添加数据
    Private Sub Command1_Click()
        Dim s As String
        Dim i As Long
        Dim c As String
        Dim t(1 To 5) As Byte
        Dim tt(1 To 2) As Byte
        Dim aa As Byte
        Dim j As Long
        
        s = Original.Text
        s = Trim(s)
        
        If 0 = Len(s) Then
            Exit Sub
        End If
        
        i = 1
        
        Do
            c = Mid(s, i, 1)
            If Not (c >= "0" And c <= "9") Then
                s = Mid$(s, 1, i - 1) + Mid$(s, i + 1)
                i = i - 1
            End If
            i = i + 1
        Loop While c <> ""    For i = 1 To 5
            t(i) = Val(Mid(s, (i - 1) * 2 + 1, 2))
        Next i
        For i = 1 To 4
            For j = 5 - i To 4
                If t(j) > t(j + 1) Then
                    aa = t(j + 1)
                    t(j + 1) = t(j)
                    t(j) = aa
                End If
            Next j
        Next i
        
        For i = 1 To 2
            tt(i) = Val(Mid(s, i * 2 + 9, 2))
        Next i
        If tt(1) > tt(2) Then
            aa = tt(2)
            tt(2) = tt(1)
            tt(1) = aa
        End If
        
        s = ""
        For i = 1 To 5
            If t(i) < 10 Then
                s = s & "0" & Trim(Str$(t(i)))
            Else
                s = s & Trim(Str$(t(i)))
            End If
        Next i
        For i = 1 To 2
            If tt(i) < 10 Then
                s = s & "0" & Trim(Str$(tt(i)))
            Else
                s = s & Trim(Str$(tt(i)))
            End If
        Next i
            Open filename For Binary As #1
        Put #1, LOF(1) + 1, s
        Put #1, LOF(1) + 1, vbCrLf$
        Close #1
        
        Original.Text = ""
    End Sub
      

  18.   

    to 楼主36楼:  “用byt类型数组进行字串比较可以提速”,我觉得没法应用到你的环境中。
      不知道其他的高人有没有办法。  你的开奖号码是字符串,要先处理成Long类型的二维数组。总体流程应该是这样: 开奖号码预处理
     For m=1 to StrEnd    '比较字符串
      处理成一维数组
      排序
      For i=1 to NumEnd   '开奖号码
       dt = 0
       for j=1 to 6
        iTest = kjh(i, j)'下面的比较要频繁用每一个号,用一个变量来暂存提高效率
        for k=1 to 11 
         if (iText = arrNum(k)) then 
          dt = dt+1 
          exit for 
         endif 
         if (iTest  < arrNum(k)) then Exit for    '这样就减少循环次数 
        next   'next k
       next     'next j
       ntw(i) = dt 
      next  'next i
     next    'next m=====================================================
      上面要用到的数值类型变量,全部声明成相同的类型。
      按我们的“一般”认识,应该用Long类型的。
      你分别试一下用Long和用Integer有多大的区别。=====================================================  如果速度仍然没有什么变化,还有一招:把你的开奖号码处理成一维数组!
      

  19.   


    单位事情太多,才抽空跑上来看看,这两毛工资挣得不容易呀,啥时中个500W偶就不干了,呵呵~TO CHEN8013:
    新的代码就是按你的这个编的,用时缩至原来的1/4,我再试一下把奖号变为一维数组,感谢你多次的耐心解答,握手!
      

  20.   

    TO JENNYVENUS:
        谢谢支持,不过你的代码我看了半天,还在云雾中...
     
        可能是我没太说明白,核心是有一个11码字串strt,与双色球的所有开奖号码[kjh(1-713)]比较,求出strt在每期开奖中的出号数量,如:strt="04 30 10 03 31 08 15 02 05 27 20"
     期    号       开奖号码                定长字串中奖数量 
     2003001  10 11 12 13 26 28           1 (10) 
     2003002  04 09 19 20 21 26           2 (04,20) 
     2003003  01 07 10 23 28 32           1 (10) 
     2003004  04 06 07 10 13 25           2 (04,10) 
     2003005  04 06 15 17 30 31           4 (04,15,30,31) 
     ...                                  ...  
     2008043  03 04 09 11 12 24           2(03,04)  上面表明,strt这个字串,在2003001期中出一个红球号码10, 用数组变量ntw(1 to 开奖期数)中表示为:ntw(1)=1 在2003002期中出两个号码04 20 表示为:ntw(2)=2 :依次类推到最后一期2008043期,中出两个红球:03 04  ntw(713)=2
    统计ntw(1 to 713)这个数组的max值为5,所以设条件:0-5=04 30 10 03 31 08 15 02 05 27 20哎,单位又有事了...
      

  21.   

    有点看明白了,全是字符串可以用filter,试试:
    Dim kTmp, sTmp
    Dim v As Long
    Dim maxValue As Long
    Dim maxKjhIdx As Long
    Dim maxStrIdx As Long
    Dim i As Long, j As Long, k As LongFor i = 1 To UBound(kjh)
        kTmp = Split(kjh(i), Chr(32))
        For j = 1 To UBound(strt)
            sTmp = Split(strt(j), Chr(32))
            v = 0
            For k = 0 To UBound(kTmp)
                v = v + UBound(Filter(sTmp, kTmp(k))) + 1
            Next k
            If v > maxValue Then
                maxValue = v
                maxKjhIdx = i
                maxStrIdx = j
            End If
        Next j
    Next i
    Debug.Print maxValue
    Debug.Print kjh(maxKjhIdx)
    Debug.Print strt(maxStrIdx)
      

  22.   

    这样好象更快点,不过我机器有点问题,你试试:
    Dim kTmp, sTmp
    Dim v As Long
    Dim maxValue As Long
    Dim maxKjhIdx As Long
    Dim maxStrIdx As Long
    Dim i As Long, j As Long, k As Long
    Dim tt = Timer
    For i = 1 To UBound(kjh)
        kTmp = Split(kjh(i), Chr(32))
        For j = 1 To UBound(strt)
            'sTmp = Split(strt(j), Chr(32))
            v = 0
            For k = 0 To UBound(kTmp)
                v = v + UBound(Split(strt(j), kTmp(k)))
            Next k
            If v > maxValue Then
                maxValue = v
                maxKjhIdx = i
                maxStrIdx = j
            End If
        Next j
    Next iDebug.Print maxValue
    Debug.Print kjh(maxKjhIdx)
    Debug.Print strt(maxStrIdx)
    Debug.Print Timer - t
    End Sub用你示例的数据测试结果:

    04 06 15 17 30 31
    12 30 17 06 04 29 10 03 31 08 15
      

  23.   

    这个贴子怎么没看到老马、CBM666、东方之珠、阿勇等元老级的人物来发言呀???
      

  24.   

    TO VBMAN2003:
    俗事缠身,未能及时回复帖子,见谅...
    测试了一下,速度不是很理想,可能是没有排除废循环的缘故,我也说不清楚
    不用求出全部的数量数组ntw()再求max值,而是直接用一个变量maxvalue这一点我觉得很好,已经加入到实用程序中,最终的小程序是chen8013与阁下程序代码的混合体,呵呵~多谢两位的二次援手,也谢谢其他参与的朋友...