אני הייתי כותב ככה:
PHP קוד:
<?php
function ck($x, $a, $b, $c, $l=0)
{
$return = 0;
if( $l == $x )
{
$return += 1;
}
else if( ($l + $a) <= $x )
{
$return += ck($x, $a, $b, $c, $l+$a);
}
else if( ($l + $b ) <= $x )
{
$return += ck($x, $a, $b, $c, $l+$b);
}
else if( ( $l + $c ) <= $x )
{
$return += ck($x, $a, $b, $c, $l+$c);
}
else
{
// nothing really
}
return $return;
}
?>
אני לא יודע בידיוק מה זה עושה אבל ככה יהיה נכון לרשום את זה.