|
136384 是正确答案! 看来还是手算思路对,哈哈
重写一下程序,答案也是136384。
<?
error_reporting(0);
$yifupai = array(
1,2,3,4,5,6,7,8,9,10,11,12,13,
1,2,3,4,5,6,7,8,9,10,11,12,13,
1,2,3,4,5,6,7,8,9,10,11,12,13,
1,2,3,4,5,6,7,8,9,10,11,12,13,
);
$counter = 0;
$total = 52;
for ( $i1=0; $i1<$total;$i1++)
{
for ( $i2=0; $i2<$total;$i2++)
{
for ( $i3=0; $i3<$total;$i3++)
{
if(
($yifupai[$i1] * 2 == $yifupai[$i2] + $yifupai[$i3] && abs($yifupai[$i3] -$yifupai[$i2]) ==2)
||
($yifupai[$i2] * 2 == $yifupai[$i1] + $yifupai[$i3] && abs($yifupai[$i3] -$yifupai[$i1]) ==2)
||
($yifupai[$i3] * 2 == $yifupai[$i2] + $yifupai[$i1] && abs($yifupai[$i2] -$yifupai[$i1]) ==2)
)
{
}
else{$counter++;}
}
}
}
echo $counter;
?>
|
2008-5-23 00:10:32
|