标题: 【原创】一个彩票14选7过滤程序
smartmouse
实习记者
Rank: 5Rank: 5
注册用户



UID 37083
精华 5
积分 1(积分有什么用?)
帖子 388
阅读权限 10
注册 2003-2-20
来自 广州市天河区
状态 离线
发表于 2006-3-3 11:47  资料  个人空间  主页 短消息  加为好友  QQ ICQ 状态 Yahoo!
【原创】一个彩票14选7过滤程序

compositor.PHP
[PHP]

<?php
function CreateFile($filename,$content)
{                       
                if (is_file ($filename))
                {
                                @unlink ($filename);
                }
                          $handle    = fopen ($filename,"w"); //打开文件指针,创建文件
                          /*
                         检查文件是否被创建且可写
                          */
                          if (!is_writable ($filename))
                          {
                                 die ("文件:".$filename."不可写,请检查其属性后重试!");
                          }
                          if (!fwrite ($handle,$content))
                          {  //将信息写入文件
                                 die ("生成文件".$filename."失败!");
                          }
                        //  echo "<br>写入文件".$filename;
                          fclose ($handle); //关闭指?
}
?>
<?php
$CombinList = array(1 => array("Y", "n"),
                    2 => array("Y", "n"),
                                        3 => array("Y", "n"),
                                        4 => array("Y", "n"),
                                        5 => array("Y", "n"),
                                        6 => array("Y", "n"),
                                        7 => array("Y", "n"),
                                        8 => array("Y", "n"),
                                        9 => array("Y", "n"),
                                        10 => array("Y", "n"),
                                        11 => array("Y", "n"),
                                        12 => array("Y", "n"),
                                        13 => array("Y", "n"),
                                        14 => array("Y", "n"));
/* 计算C(a,1) * C(b, 1) * ... * C(n, 1)的值 */
$CombineCount = 1;
foreach($CombinList as $Key => $Value)
{
    $CombineCount *= count($Value);
}

$RepeatTime = $CombineCount;
foreach($CombinList as $ClassNo => $StudentList)
{

    $RepeatTime = $RepeatTime / count($StudentList);

    $StartPosition = 1;


    foreach($StudentList as $Student)
    {
        $TempStartPosition = $StartPosition;

        $SpaceCount = $CombineCount / count($StudentList) / $RepeatTime;

        for($J = 1; $J <= $SpaceCount; $J ++)
        {
            for($I = 0; $I < $RepeatTime; $I ++)
            {
               $Result[$TempStartPosition + $I][$ClassNo] = $Student;
            }
            $TempStartPosition += $RepeatTime * count($StudentList);
        }
        $StartPosition += $RepeatTime;
    }
}

/* 打印结果 */
//echo "<pre>";
//print_r($Result);
$count = count($Result);
for ($i=0;$i<$count;$i++)
{
        $scount=0;
        $strtmp = $Result[$i][1];
        for($j=1;$j<=14;$j++)
        {
                if($Result[$i][$j]=='Y')
                {
                  $scount=$scount+1;
                //echo "\r\n";
                }
        }
        ///echo $scount."\n";
        if ($scount==7)
        {
                //echo ($strtmp);
                //print_r($Result[$i]);
                $tmpstr.=$Result[$i][1].$Result[$i][2].$Result[$i][3].$Result[$i][4].$Result[$i][5].$Result[$i][6].$Result[$i][7].$Result[$i][8].$Result[$i][9].$Result[$i][10].$Result[$i][11].$Result[$i][12].$Result[$i][13].$Result[$i][14].":1-6;";
        }
}

echo ($tmpstr);
CreateFile("log.txt",$tmpstr);
exit;
?>


[/PHP]





我在CSDN的blog: http://blog.csdn.net/forlinux 欢迎光临 -------------------------------- my life is for linux ,for my dream !
顶部
不容错过的IBM 集群技术资源汇总
=Damao=
新生入学
Rank: 1
注册用户



UID 91545
精华 0
积分 0(积分有什么用?)
帖子 4
阅读权限 10
注册 2004-8-6
来自 北京
状态 离线
发表于 2007-5-22 16:46  资料  个人空间  短消息  加为好友 
我打下来,看看~





You're so special I wish I was special...
顶部
不容错过的IBM 集群技术资源汇总
 



当前时区 GMT+8, 现在时间是 2008-5-17 11:34

    Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.070346 second(s), 5 queries

清除 Cookies - 联系我们 - Linux伊甸园 - Archiver - WAP