无为清净楼资源网 Design By www.qnjia.com
本文实例讲述了PHP实现的简单排列组合算法应用。分享给大家供大家参考,具体如下:
一、问题:
给你一个40斤的西瓜,给3个人分,有多少种分法?
二、PHP实现代码:
<"htmlcode">Array ( [0] => Array ( [0] => 1 [1] => 38 [2] => 1 ) [1] => Array ( [0] => 2 [1] => 37 [2] => 1 ) [2] => Array ( [0] => 3 [1] => 36 [2] => 1 ) [3] => Array ( [0] => 4 [1] => 35 [2] => 1 ) [4] => Array ( [0] => 5 [1] => 34 [2] => 1 ) [5] => Array ( [0] => 6 [1] => 33 [2] => 1 ) [6] => Array ( [0] => 7 [1] => 32 [2] => 1 ) [7] => Array ( [0] => 8 [1] => 31 [2] => 1 ) [8] => Array ( [0] => 9 [1] => 30 [2] => 1 ) [9] => Array ( [0] => 10 [1] => 29 [2] => 1 ) [10] => Array ( [0] => 11 [1] => 28 [2] => 1 ) [11] => Array ( [0] => 12 [1] => 27 [2] => 1 ) [12] => Array ( [0] => 13 [1] => 26 [2] => 1 ) [13] => Array ( [0] => 14 [1] => 25 [2] => 1 ) [14] => Array ( [0] => 15 [1] => 24 [2] => 1 ) [15] => Array ( [0] => 16 [1] => 23 [2] => 1 ) [16] => Array ( [0] => 17 [1] => 22 [2] => 1 ) [17] => Array ( [0] => 18 [1] => 21 [2] => 1 ) [18] => Array ( [0] => 19 [1] => 20 [2] => 1 ) [19] => Array ( [0] => 20 [1] => 19 [2] => 1 ) [20] => Array ( [0] => 21 [1] => 18 [2] => 1 ) [21] => Array ( [0] => 22 [1] => 17 [2] => 1 ) [22] => Array ( [0] => 23 [1] => 16 [2] => 1 ) [23] => Array ( [0] => 24 [1] => 15 [2] => 1 ) [24] => Array ( [0] => 25 [1] => 14 [2] => 1 ) [25] => Array ( [0] => 26 [1] => 13 [2] => 1 ) [26] => Array ( [0] => 27 [1] => 12 [2] => 1 ) [27] => Array ( [0] => 28 [1] => 11 [2] => 1 ) [28] => Array ( [0] => 29 [1] => 10 [2] => 1 ) [29] => Array ( [0] => 30 [1] => 9 [2] => 1 ) [30] => Array ( [0] => 31 [1] => 8 [2] => 1 ) [31] => Array ( [0] => 32 [1] => 7 [2] => 1 ) [32] => Array ( [0] => 33 [1] => 6 [2] => 1 ) [33] => Array ( [0] => 34 [1] => 5 [2] => 1 ) [34] => Array ( [0] => 35 [1] => 4 [2] => 1 ) [35] => Array ( [0] => 36 [1] => 3 [2] => 1 ) [36] => Array ( [0] => 37 [1] => 2 [2] => 1 ) [37] => Array ( [0] => 38 [1] => 1 [2] => 1 ) )更多关于PHP相关内容感兴趣的读者可查看本站专题:《PHP数据结构与算法教程》、《PHP基本语法入门教程》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》
希望本文所述对大家PHP程序设计有所帮助。
标签:
PHP,排列,组合,算法
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年11月18日
2024年11月18日
- 【雨果唱片】中国管弦乐《鹿回头》WAV
- APM亚流新世代《一起冒险》[FLAC/分轨][106.77MB]
- 崔健《飞狗》律冻文化[WAV+CUE][1.1G]
- 罗志祥《舞状元 (Explicit)》[320K/MP3][66.77MB]
- 尤雅.1997-幽雅精粹2CD【南方】【WAV+CUE】
- 张惠妹.2007-STAR(引进版)【EMI百代】【WAV+CUE】
- 群星.2008-LOVE情歌集VOL.8【正东】【WAV+CUE】
- 罗志祥《舞状元 (Explicit)》[FLAC/分轨][360.76MB]
- Tank《我不伟大,至少我能改变我。》[320K/MP3][160.41MB]
- Tank《我不伟大,至少我能改变我。》[FLAC/分轨][236.89MB]
- CD圣经推荐-夏韶声《谙2》SACD-ISO
- 钟镇涛-《百分百钟镇涛》首批限量版SACD-ISO
- 群星《继续微笑致敬许冠杰》[低速原抓WAV+CUE]
- 潘秀琼.2003-国语难忘金曲珍藏集【皇星全音】【WAV+CUE】
- 林东松.1997-2039玫瑰事件【宝丽金】【WAV+CUE】