杨辉三角的多种解法(Multiple solutions of Yang Huis triangle).doc

杨辉三角的多种解法(Multiple solutions of Yang Huis triangle).doc

  1. 1、本文档共37页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
杨辉三角的多种解法(Multiple solutions of Yang Huis triangle).doc

杨辉三角的多种解法(Multiple solutions of Yang Huis triangle) Multiple solutions of 7. Yang Huis triangle The form of the Yang Hui triangle is as follows: One 11 121 1331 146411615201561 172135352171 18285670562881 193684126126843691 ...... Rule: except the elements on both sides are 1, the value of each position in the other is equal to the sum of the elements on the two shoulders. This may be because the output of Pyramid like not too easy to program output, see some books are going direct is as follows: One 11 121 1331 146411615201561 172135352171 18285670562881 193684126126843691 Rule: in addition to both sides of the elements are 1, the rest of each position of the element value is the upper left corner elements and the sum of the above elements, so easy to use array. Two dimensional array: First of all, its easier to think of a two-dimensional array, and try to write one (just 10 lines). Ideas: first the elements on both sides of each line, start and end values are set to 1, then from the beginning of the third line (line one or two to 1), among other elements and two elements for the upper left corner and right above the elements and elements. #include stdio.h #define N / * * / 10 dimension Int main () { Int i; Int j; Int a[N][N]; two-dimensional array stored Yang Hui triangle / * definition For (I = 0; I N; i++) { A[0] = 1; / * * / 1 values for each line begins A = 1; / * the end of each line is 1. } For (I = 2; I N; i++) For (J = 1; J I; j++) A[j] = a[i-1][j-1] + a[i-1][j]; / * Law: on the left and on the sum of the elements. For (I = 0; I N; i++) { For (J = 0; J I; j++) Printf (%-5d, a[j]); Printf (\n); } Return 0; } Operation result (VC): =============================================================== One 11 121 1331 146411615201561 172135352171 18285670562881 193684126126843691 =============================================================== So how do you display the shape of Pyramid? The problem is how to space the number of each

文档评论(0)

zhangningclb + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档