{"id":37,"date":"2021-10-26T08:13:15","date_gmt":"2021-10-26T00:13:15","guid":{"rendered":"https:\/\/dcupqiu.club\/?p=37"},"modified":"2022-02-20T19:16:20","modified_gmt":"2022-02-20T11:16:20","slug":"number-of-ways-to-rearrange-sticks-with-k-sticks-visible","status":"publish","type":"post","link":"https:\/\/dcupqiu.club\/?p=37","title":{"rendered":"Number of Ways to Rearrange Sticks With K Sticks Visible"},"content":{"rendered":"<p><a href=\"https:\/\/leetcode-cn.com\/problems\/number-of-ways-to-rearrange-sticks-with-k-sticks-visible\/\">https:\/\/leetcode-cn.com\/problems\/number-of-ways-to-rearrange-sticks-with-k-sticks-visible\/<\/a><\/p>\n<p>\u6211\u4eec\u7528 f(i, j) \u8868\u793a\u957f\u5ea6\u4e3a 1,2,\u22ef,i \u7684\u6728\u68cd\u4e14\u53ef\u4ee5\u53ef\u4ee5\u770b\u5230\u5176\u4e2d\u7684 jj \u6839\u6728\u68cd\u7684\u65b9\u6848\u6570\u3002<\/p>\n<p>\u5728\u8fdb\u884c\u72b6\u6001\u8f6c\u79fb\u7684\u65f6\u5019\uff0c\u6211\u4eec\u53ef\u4ee5\u8003\u8651\u6700\u540e\u4e00\u6839\u6728\u68cd\u662f\u5426\u53ef\u4ee5\u88ab\u770b\u5230\uff1a<\/p>\n<p>\u5982\u679c\u53ef\u4ee5\u88ab\u770b\u5230\uff0c\u90a3\u4e48\u6700\u540e\u4e00\u6839\u6728\u68cd\u7684\u957f\u5ea6\u4e00\u5b9a\u4e3a i\uff0c\u56e0\u6b64\u524d i\u22121 \u6839\u6728\u68cd\u7684\u957f\u5ea6\u6070\u597d\u4e3a 1,2,\u22efi\u22121 \u7684\u4e00\u4e2a\u6392\u5217\uff0c\u5e76\u4e14\u53ef\u4ee5\u770b\u5230\u5176\u4e2d\u7684 j\u22121 \u6839\u6728\u68cd\u3002\u8fd9\u6837\u5c31\u6709\u72b6\u6001\u8f6c\u79fb\u65b9\u7a0b\uff1a<\/p>\n<p>f(i, j) = f(i &#8211; 1, j &#8211; 1)<\/p>\n<p>\u5982\u679c\u4e0d\u53ef\u4ee5\u88ab\u770b\u5230\uff0c\u90a3\u4e48\u6700\u540e\u4e00\u6839\u6728\u68cd\u7684\u957f\u5ea6\u4e3a [1, i-1] \u4e2d\u7684\u67d0\u4e2a\u503c\u3002\u5047\u8bbe\u8fd9\u4e2a\u503c\u4e3a x\uff0c\u90a3\u4e48\u524d i-1 \u6839\u6728\u68cd\u7684\u957f\u5ea6\u4e3a 1,\u22ef,x\u22121,x+1,\u22ef,i \u7684\u4e00\u4e2a\u6392\u5217\uff0c\u5e76\u4e14\u53ef\u4ee5\u770b\u5230\u5176\u4e2d\u7684 j \u6839\u6728\u68cd\u3002<\/p>\n<p>\u7531\u4e8e\u4e00\u6839\u6728\u68cd\u80fd\u5426\u88ab\u770b\u5230\u53ea\u4e0e\u5b83\u548c\u5b83\u5de6\u4fa7\u6728\u68cd\u7684\u300c\u76f8\u5bf9\u9ad8\u5ea6\u5173\u7cfb\u300d\u6709\u5173\uff0c\u800c\u4e0e\u300c\u7edd\u5bf9\u9ad8\u5ea6\u5173\u7cfb\u300d\u65e0\u5173\u3002\u56e0\u6b64\u5982\u679c\u6211\u4eec\u5c06\u957f\u5ea6\uff1a<br \/>1,\u22ef,x\u22121,x+1,\u22ef,i<\/p>\n<p>\u6309\u7167\u987a\u5e8f\u91cd\u65b0\u5206\u914d\u4e3a\uff1a<br \/>1,2,\u22ef,i\u22121<\/p>\n<p>\u90a3\u4e48\u4efb\u610f\u4e24\u6839\u6728\u68cd\u7684\u300c\u76f8\u5bf9\u9ad8\u5ea6\u5173\u7cfb\u300d\u90fd\u4fdd\u6301\u4e0d\u53d8\uff0c\u5373\u6211\u4eec\u4ecd\u7136\u53ef\u4ee5\u770b\u5230 jj \u6839\u6728\u68cd\uff0c\u6ee1\u8db3\u8981\u6c42\u7684\u6392\u5217\u6570\u4e3a f(i\u22121,j)\uff0c\u4e0e x \u7684\u53d6\u503c\u65e0\u5173\u3002\u8fd9\u6837\u5c31\u6709\u72b6\u6001\u8f6c\u79fb\u65b9\u7a0b\uff1a<br \/>f(i,j)=(i\u22121)\u22c5f(i\u22121,j)<\/p>\n<p>\u5c06\u4e0a\u9762\u7684\u4e24\u79cd\u60c5\u51b5\u6c42\u548c\uff0c\u5373\u53ef\u5f97\u5230\u6700\u7ec8\u7684\u72b6\u6001\u8f6c\u79fb\u65b9\u7a0b\uff1a<br \/>f(i,j)=f(i\u22121,j\u22121)+(i\u22121)\u22c5f(i\u22121,j)<\/p>\n<p>\u6700\u7ec8\u7684\u7b54\u6848\u5373\u4e3a f(n,k)\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/leetcode-cn.com\/p&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[5],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-leetcode","tag-leetcode"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.5.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Number of Ways to Rearrange Sticks With K Sticks Visible - \u79cb\u5586\u306eSite<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dcupqiu.club\/?p=37\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Number of Ways to Rearrange Sticks With K Sticks Visible - \u79cb\u5586\u306eSite\" \/>\n<meta property=\"og:description\" content=\"https:\/\/leetcode-cn.com\/p...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dcupqiu.club\/?p=37\" \/>\n<meta property=\"og:site_name\" content=\"\u79cb\u5586\u306eSite\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-26T00:13:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-20T11:16:20+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79cb\u5586\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dcupqiu.club\/#website\",\"url\":\"https:\/\/dcupqiu.club\/\",\"name\":\"\u79cb\u5586\u306eSite\",\"description\":\"WwwwwW\",\"publisher\":{\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dcupqiu.club\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dcupqiu.club\/?p=37#webpage\",\"url\":\"https:\/\/dcupqiu.club\/?p=37\",\"name\":\"Number of Ways to Rearrange Sticks With K Sticks Visible - \u79cb\u5586\u306eSite\",\"isPartOf\":{\"@id\":\"https:\/\/dcupqiu.club\/#website\"},\"datePublished\":\"2021-10-26T00:13:15+00:00\",\"dateModified\":\"2022-02-20T11:16:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dcupqiu.club\/?p=37#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dcupqiu.club\/?p=37\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dcupqiu.club\/?p=37#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/dcupqiu.club\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Number of Ways to Rearrange Sticks With K Sticks Visible\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/dcupqiu.club\/?p=37#article\",\"isPartOf\":{\"@id\":\"https:\/\/dcupqiu.club\/?p=37#webpage\"},\"author\":{\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\"},\"headline\":\"Number of Ways to Rearrange Sticks With K Sticks Visible\",\"datePublished\":\"2021-10-26T00:13:15+00:00\",\"dateModified\":\"2022-02-20T11:16:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dcupqiu.club\/?p=37#webpage\"},\"wordCount\":68,\"publisher\":{\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\"},\"keywords\":[\"Leetcode\"],\"articleSection\":[\"Leetcode\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20\",\"name\":\"\u79cb\u5586\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/dcupqiu.club\/#personlogo\",\"inLanguage\":\"zh-Hans\",\"url\":\"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png\",\"contentUrl\":\"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png\",\"width\":920,\"height\":700,\"caption\":\"\u79cb\u5586\"},\"logo\":{\"@id\":\"https:\/\/dcupqiu.club\/#personlogo\"},\"sameAs\":[\"http:\/\/dcupqiu.club\"],\"url\":\"https:\/\/dcupqiu.club\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Number of Ways to Rearrange Sticks With K Sticks Visible - \u79cb\u5586\u306eSite","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dcupqiu.club\/?p=37","og_locale":"zh_CN","og_type":"article","og_title":"Number of Ways to Rearrange Sticks With K Sticks Visible - \u79cb\u5586\u306eSite","og_description":"https:\/\/leetcode-cn.com\/p...","og_url":"https:\/\/dcupqiu.club\/?p=37","og_site_name":"\u79cb\u5586\u306eSite","article_published_time":"2021-10-26T00:13:15+00:00","article_modified_time":"2022-02-20T11:16:20+00:00","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79cb\u5586"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/dcupqiu.club\/#website","url":"https:\/\/dcupqiu.club\/","name":"\u79cb\u5586\u306eSite","description":"WwwwwW","publisher":{"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dcupqiu.club\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"https:\/\/dcupqiu.club\/?p=37#webpage","url":"https:\/\/dcupqiu.club\/?p=37","name":"Number of Ways to Rearrange Sticks With K Sticks Visible - \u79cb\u5586\u306eSite","isPartOf":{"@id":"https:\/\/dcupqiu.club\/#website"},"datePublished":"2021-10-26T00:13:15+00:00","dateModified":"2022-02-20T11:16:20+00:00","breadcrumb":{"@id":"https:\/\/dcupqiu.club\/?p=37#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dcupqiu.club\/?p=37"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dcupqiu.club\/?p=37#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/dcupqiu.club\/"},{"@type":"ListItem","position":2,"name":"Number of Ways to Rearrange Sticks With K Sticks Visible"}]},{"@type":"Article","@id":"https:\/\/dcupqiu.club\/?p=37#article","isPartOf":{"@id":"https:\/\/dcupqiu.club\/?p=37#webpage"},"author":{"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20"},"headline":"Number of Ways to Rearrange Sticks With K Sticks Visible","datePublished":"2021-10-26T00:13:15+00:00","dateModified":"2022-02-20T11:16:20+00:00","mainEntityOfPage":{"@id":"https:\/\/dcupqiu.club\/?p=37#webpage"},"wordCount":68,"publisher":{"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20"},"keywords":["Leetcode"],"articleSection":["Leetcode"],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/dcupqiu.club\/#\/schema\/person\/33f847360b49873a92e0a1461d4d6a20","name":"\u79cb\u5586","image":{"@type":"ImageObject","@id":"https:\/\/dcupqiu.club\/#personlogo","inLanguage":"zh-Hans","url":"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png","contentUrl":"https:\/\/dcupqiu.club\/wp-content\/uploads\/\/2022\/04\/ww.png","width":920,"height":700,"caption":"\u79cb\u5586"},"logo":{"@id":"https:\/\/dcupqiu.club\/#personlogo"},"sameAs":["http:\/\/dcupqiu.club"],"url":"https:\/\/dcupqiu.club\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":1,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":70,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions\/70"}],"wp:attachment":[{"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dcupqiu.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}