{"id":2816,"date":"2023-10-18T10:31:18","date_gmt":"2023-10-18T02:31:18","guid":{"rendered":"https:\/\/white-night.club\/?p=2816"},"modified":"2023-11-09T11:07:48","modified_gmt":"2023-11-09T03:07:48","slug":"ad72","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/18\/ad72\/","title":{"rendered":"\u6768\u8f89\u4e09\u89d2\uff1a\u52a8\u6001\u89c4\u5212"},"content":{"rendered":"\n<p>\u672c\u8d28\u8fd8\u662f\u4e00\u7ef4\u6570\u7ec4\u7684\u52a8\u6001\u89c4\u5212\u3002<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u4ec0\u4e48\u662f\u6768\u8f89\u4e09\u89d2<\/p>\n<cite><em>\u5728\u300c\u6768\u8f89\u4e09\u89d2\u300d\u4e2d\uff0c\u6bcf\u4e2a\u6570\u662f\u5b83\u5de6\u4e0a\u65b9\u548c\u53f3\u4e0a\u65b9\u7684\u6570\u7684\u548c\u3002<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u5f15\u7528\u4e00\u4e0bleetcode\u4e0a\u7684\u6768\u8f89\u4e09\u89d2\u7684gif<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large has-custom-border\"><img decoding=\"async\" src=\"https:\/\/pic.leetcode-cn.com\/1626927345-DZmfxB-PascalTriangleAnimated2.gif\" alt=\"\" style=\"border-style:none;border-width:0px;border-radius:0px\"\/><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u4ece\u7b2c\u4e09\u884c\u5f00\u59cb\uff0c\u6bcf\u4e00\u884c\u7684\u8ba1\u7b97\u7ed3\u679c\u90fd\u53ef\u4ee5\u4ece\u4e0a\u4e00\u884c\u7684\u7ed3\u679c\u4e2d\u5f97\u51fa\u3002\u6211\u4eec\u56de\u5230\u52a8\u6001\u89c4\u5212\u7684\u5b9a\u4e49\uff1a<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><em>\u5c06\u9012\u5f52\u7b97\u6cd5\u91cd\u65b0\u5199\u6210\u975e\u9012\u5f52\u7b97\u6cd5\uff0c\u5e76\u5c06\u5b50\u95ee\u9898\u7684\u7b54\u6848\u7cfb\u7edf\u7684\u8bb0\u5f55\u5728\u8868\u4e2d<\/em><\/strong><\/p>\n\n\n\n<p>\u6bd4\u5982\u6211\u4eec\u8981\u6c42\u51fa\u6768\u8f89\u4e09\u89d2\u7684\u7b2c\u56db\u884c\u3002\u7b2c\u56db\u884c\u7684\u9996\u5c3e\u7ed3\u679c\u80af\u5b9a\u662f1\uff0c\u8fd9\u4e2a\u4e0d\u7528\u591a\u8bf4\u3002\u800c\u4ece\u7b2c\u56db\u884c\u7684\u7b2ci\u9879\u5f00\u59cb\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0);color:#fcb900\" class=\"has-inline-color\">\u6bcf\u4e00\u9879\u90fd\u662f\u4e0a\u4e00\u884c\uff08\u5373\u7b2c\u4e09\u884c\uff09\u7684\u7b2ci-1\u9879\u548c\u7b2ci+1\u9879\u7684\u548c<\/mark>\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u76f4\u63a5\u653eleetcode\u9898\u76ee\uff1a<a href=\"https:\/\/leetcode.cn\/problems\/pascals-triangle\/\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0086ff\" class=\"has-inline-color\">118.&nbsp;\u6768\u8f89\u4e09\u89d2<\/mark><\/a>\u7684C++\u4ee3\u7801\u4e86\uff0c\u6bd5\u7adf\u8f6c\u6210\u672c\u5730\u8fd0\u884c\u7684C++\u4ee3\u7801\u4e5f\u4e0d\u96be\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\npublic:\n    vector&lt;vector&lt;int&gt;&gt; generate(int numRows) {\n        vector&lt;vector&lt;int&gt;&gt; result(numRows);\n        for(int i=0;i&lt;numRows;i++)\n        {\n            result&#91;i].resize(i+1);\n            result&#91;i]&#91;0]=result&#91;i]&#91;i]=1;\n            for(int j=1;j&lt;i;j++)\n            {\n                if(i&gt;=2)\n                {\n                    result&#91;i]&#91;j]=result&#91;i-1]&#91;j-1]+result&#91;i-1]&#91;j];\n                }\n            }\n        }\n        return result;\n    }\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7\u52a8\u6001\u89c4\u5212\u6c42\u89e3\u6768\u8f89\u4e09\u89d2\u524dn\u884c<\/p>\n","protected":false},"author":1,"featured_media":2850,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[25,50],"tags":[102,36],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2816"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=2816"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2816\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2850"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=2816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}