{"id":437,"date":"2022-09-22T22:50:48","date_gmt":"2022-09-22T14:50:48","guid":{"rendered":"https:\/\/qaqaq.top\/?p=437"},"modified":"2022-11-27T12:40:01","modified_gmt":"2022-11-27T04:40:01","slug":"%e4%ba%8c%e7%bb%b4%e6%95%b0%e7%bb%84%e7%bb%83%e4%b9%a0%ef%bc%9a%e6%9d%a8%e8%be%89%e4%b8%89%e8%a7%92","status":"publish","type":"post","link":"https:\/\/qaqaq.top\/?p=437","title":{"rendered":"\u6570\u7ec4-\u4e8c\u7ef4\u6570\u7ec4\u7ec3\u4e60\uff1a\u6768\u8f89\u4e09\u89d2"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P158;\n\/*\n * \u4f7f\u7528\u4e8c\u7ef4\u6570\u7ec4\u6253\u5370\u4e00\u4e2a 10 \u884c\u6768\u8f89\u4e09\u89d2\u3002\n * \n\t\u3010\u63d0\u793a\u3011\n\t1. \u7b2c\u4e00\u884c\u6709 1 \u4e2a\u5143\u7d20, \u7b2c n \u884c\u6709 n \u4e2a\u5143\u7d20\n\t2. \u6bcf\u4e00\u884c\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\u548c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u90fd\u662f 1\n\t3. \u4ece\u7b2c\u4e09\u884c\u5f00\u59cb, \u5bf9\u4e8e\u975e\u7b2c\u4e00\u4e2a\u5143\u7d20\u548c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u7684\u5143\u7d20\u3002\u5373\uff1a\n\tyanghui&#91;i]&#91;j] = yanghui&#91;i-1]&#91;j-1] + yanghui&#91;i-1]&#91;j];\n * \n * \n *\/\npublic class YangHuiTest {\n\t\n\tpublic static void main(String&#91;] args) {\n\t\t\/\/1. \u58f0\u660e\u5e76\u521d\u59cb\u5316\u4e8c\u7ef4\u6570\u7ec4\n\t\tint&#91;]&#91;] yangHui = new int&#91;10]&#91;];\n\t\t\/\/2. \u7ed9\u6570\u7ec4\u7684\u5143\u7d20\u8d4b\u503c\n\t\tfor(int i = 0; i &lt; yangHui.length; i++) {\n\t\t\tyangHui&#91;i] = new int&#91;i + 1];\n\t\t\t\n\t\t\t\/\/2.1 \u7ed9\u9996\u672b\u5143\u7d20\u8d4b\u503c\n\t\t\tyangHui&#91;i]&#91;0] = yangHui&#91;i]&#91;i] = 1;\n\t\t\t\/\/2.2 \u7ed9\u6bcf\u884c\u7684\u975e\u9996\u672b\u5143\u7d20\u8d4b\u503c\n\/\/\t\t\tif(i &gt; 1) {\n\t\t\tfor(int j = 1; j &lt; yangHui&#91;i].length - 1; j++) {\n\t\t\t\tyangHui&#91;i]&#91;j] = yangHui&#91;i-1]&#91;j-1] + yangHui&#91;i-1]&#91;j];\n\t\t\t}\n\/\/\t\t\t}\n\t\t}\n\t\t\n\t\t\/\/3. \u904d\u5386\u4e8c\u7ef4\u6570\u7ec4\n\t\tfor(int i = 0; i &lt; yangHui.length; i++) {\n\t\t\tfor(int j = 0; j &lt; yangHui&#91;i].length; j++) {\n\t\t\t\tSystem.out.print(yangHui&#91;i]&#91;j] + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t\t\n\t}\n\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[46],"class_list":["post-437","post","type-post","status-publish","format-standard","hentry","category-java-code","tag-java"],"_links":{"self":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/437"}],"collection":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=437"}],"version-history":[{"count":2,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/437\/revisions"}],"predecessor-version":[{"id":494,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/437\/revisions\/494"}],"wp:attachment":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}