Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $n=5;
- r($n);
- function r($left,$min=0,$i=0){
- global $a,$n;
- if($left<0||$min==$n)return;
- $a[$i]=$min;
- if($min!=0){
- r($left-$min,$min,$i+1);
- }
- r($left-1,$min+1,$i);
- if($left==0){
- for($j=0;$j<=$i;++$j){
- echo $a[$j].($j!=$i?'+':PHP_EOL);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement