PHP之猴子吃桃

WBOY
Release: 2016-07-28 08:26:04
Original
3302 people have browsed it

猴子吃桃 :
第一天吃一半 +1;
第二天吃一半+1;
10天后 剩一个
求一共有多少个

$total=1;
    $totalar=array();
    $totalar[0]=1;
    for($i=0;$i9;$i++){
       $total=2*(1+$total);
       $totalar[$i+1]=$total;
       echo$total;
    }

    //将数组逆序$totals=array_reverse($totalar);
    //输出for($i=1;$i$totals)+1;$i++){
       echo"第{$i}天".$totals[$i-1].'
'
; }
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了 PHP之猴子吃桃,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!