精 彩 论 坛已经更名为百强频道,迁新地址www.bqpd.cn

亲爱的朋友,首先为给您带来的不便深表歉意,现因发展的需要,精彩论坛迁到新的地址http://www.bqpd.cn,还望您一如既往地支持精彩论坛,谢谢
精 彩 论 坛已经更名为百强频道,迁新地址www.bqpd.cn

论坛因发展的需要现已经迁址www.bqpd.cn,等待您的到来。谢谢


    3D相关总值多项分析

    分享
    avatar
    一品明灯
    Admin

    帖子数 : 292
    积分 : 720
    威望 : 4
    注册日期 : 10-03-02
    年龄 : 8

    普通 3D相关总值多项分析

    帖子 由 一品明灯 于 2010-03-11, 14:43

    3D相关总值多项分析
    '==========================================================

    Function Main
    '===============申明或定义变量=============
    CpRowCount = CpData.RowCount '开奖期数
    CpColCount = CpData.ColCount '开奖号码个数
    CpMaxCode = CpData.MaxCode '最大号码
    CpMinCode = CpData.MinCode '最小号码
    CpCodeCount = CpData.CodeCount '号码数量

    '=================建表=================
    CpAna.AddField "期号",8
    CpAna.AddField "开奖号码",CpColCount*3
    CpAna.AddField "相关总值", 8
    CpAna.AddField "相关总值和值", 12
    CpAna.AddField "相关总值合值", 12
    CpAna.AddField "相关总值十位", 12
    CpAna.AddField "相关总值个位", 12
    CpAna.AddField "相关总值跨度", 12
    CpAna.RowCount = CpRowCount
    CpAna.CreateTable()

    '==============算法主体============================
    ReDim Count1(CpCodeCount)' 号码出现次数
    ReDim Count2(CpCodeCount, CpCodeCount)'号码两两同时出现次数
    ReDim Code(CpColCount)'存放开奖号码

    for i=0 to CpCodeCount-1
    Count1(i)=0
    for j=0 to CpCodeCount-1
    Count2(i,j)=0
    next
    next

    For row = 0 to CpRowCount-1
    '存放开奖号码
    For col = 0 to CpColCount - 1
    Code(col) = CpData.Code(row, col)
    Next

    '标记重复号码
    For i = 0 to CpColCount - 1
    if Code(i)<>-1 then
    For j = i+1 to CpColCount - 1
    if Code(i)=Code(j) then
    Code(j)=-1
    end if
    next
    end if
    next

    For i = 0 to CpColCount - 1
    if Code(i)<>-1 then
    '求号码出现次数
    Index1 = Code(i)-CpMinCode
    Count1(Index1) = Count1(Index1) + 1

    '求两两号码同时出现次数
    For j = i+1 to CpColCount - 1
    if Code(j)<>-1 then
    Index2 = Code(j) - CpMinCode
    if Index1 Count2(Index1,Index2) = Count2(Index1,Index2) + 1
    else
    Count2(Index2,Index1) = Count2(Index2,Index1) + 1
    end if
    end if
    Next
    end if
    Next

    '求开奖号码两两相关系数之和
    cnt = 0
    sum = 0
    For i = 0 to CpColCount-1
    if Code(i)<>-1 then
    index1 = Code(i)-CpMinCode
    For j = i+1 to CpColCount-1
    if Code(j)<>-1 then
    index2 = Code(j)-CpMinCode
    if index1 n = Count2(index1, index2)'两两开奖号同时出现次数
    else
    n = Count2(index2, index1)
    end if
    m = Count1(index1) + Count1(index2)'两两开奖号出现次数之和
    If m <> 0 then
    sum = sum + (n / m * 2 * 100) '相关系数=a、b同时出现次数/(a出现次数+b出现次数)*2*100
    End If
    cnt = cnt+1
    end if
    Next
    end if
    Next
    CpAna.Cell(row, "期号") = CpData.Seq(row)
    CpAna.Cell(row, "开奖号码") = CpData.CodeStr(row)
    CpAna.Cell(row, "相关总值") = Int(sum)
    CpAna.Cell(row, "相关总值和值") = (Int(sum)\10)+(Int(sum) mod 10)
    CpAna.Cell(row, "相关总值合值") =(((Int(sum)\10)+(Int(sum) mod 10))\10+((Int(sum)\10)+(Int(sum) mod 10)) mod 10) mod 10
    CpAna.Cell(row, "相关总值十位") = (Int(sum)\10)
    CpAna.Cell(row, "相关总值个位") = (Int(sum) mod 10)
    CpAna.Cell(row, "相关总值跨度") =abs((Int(sum)\10)-(Int(sum) mod 10))
    Next
    End Function


    _________________
    一流的条件 精彩的论坛

      目前的日期/时间是2018-04-25, 02:04