{"id":111447,"date":"2026-10-01T07:51:05","date_gmt":"2026-09-30T23:51:05","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/111447.html"},"modified":"2026-10-01T07:51:05","modified_gmt":"2026-09-30T23:51:05","slug":"%e5%8a%a8%e6%80%81%e8%a7%84%e5%88%92%e4%b9%8b%e7%8a%b6%e6%80%81%e5%ae%9a%e4%b9%89%e7%9a%84%e6%8a%80%e5%b7%a7","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/111447.html","title":{"rendered":"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7"},"content":{"rendered":"<p><span style=\"color:#0d0016\">\u3010\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7\u3011 &gt;\u00a0\u6838\u5fc3\u539f\u5219&#xff1a;\u72b6\u6001\u9700\u8981\u5b8c\u6574\u63cf\u8ff0\u5f53\u524d\u5c40\u9762&#xff0c;\u6ee1\u8db3\u201c\u65e0\u540e\u6548\u6027\u201d&#xff08;<\/span><span style=\"color:#fe2c24\">\u8fc7\u5f80\u7684\u9009\u62e9\u4e0d\u4f1a\u5e72\u6270\u540e\u7eed\u51b3\u7b56<\/span><span style=\"color:#0d0016\">&#xff09;&#xff0c;\u540c\u65f6\u5b50\u95ee\u9898\u80fd\u591f\u91cd\u590d\u4f7f\u7528\u3002 &gt; \u4e00\u53e5\u8bdd\u6982\u62ec&#xff1a;\u72b6\u6001\u8bb0\u5f55\u300c\u5df2\u7ecf\u5b8c\u6210\u7684\u64cd\u4f5c\u3001\u5269\u4f59\u7684\u7ea6\u675f\u6761\u4ef6\u300d&#xff0c;\u4e0d\u4fdd\u5b58\u5b8c\u6574\u8fc7\u7a0b\u7ec6\u8282\u3002  \u2705 \u6280\u5de7 1&#xff1a;\u63d0\u53d6\u9898\u5e72\u7ea6\u675f&#xff0c;\u76f4\u63a5\u4f5c\u4e3a\u72b6\u6001\u53c2\u6570&#xff08;\u6700\u5b9e\u7528&#xff09; \u62ff\u5230\u9898\u76ee&#xff0c;\u5148\u63d0\u53d6\u9898\u5e72\u4e2d\u7684\u9650\u5236\u6761\u4ef6&#xff0c;\u7528\u4f5c dp \u6570\u7ec4\u7684\u4e0b\u6807\u3002\u9898\u76ee\u5b58\u5728\u51e0\u4e2a\u7ef4\u5ea6\u7684\u7ea6\u675f&#xff0c;\u72b6\u6001\u901a\u5e38\u5c31\u8bbe\u4e3a\u51e0\u7ef4\u3002 \u4f8b&#xff1a;\u6d1b\u8c37 P1077&#xff1a;\u6446\u82b1&#xff08;<\/span>https:\/\/blog.csdn.net\/hnjzsyjyj\/article\/details\/166692286<span style=\"color:#0d0016\">&#xff09; \u7ea6\u675f&#xff1a;\u2460\u5904\u7406\u5230\u7b2c i \u79cd\u82b1&#xff1b;\u2461\u603b\u5171\u6446\u653e j \u76c6\u82b1\u3002 \u72b6\u6001&#xff1a;<\/span><span style=\"color:#fe2c24\">dp[i][j] \u8868\u793a\u524d i \u79cd\u82b1&#xff0c;\u6446\u653e j \u76c6\u7684\u65b9\u6848\u603b\u6570<\/span><span style=\"color:#0d0016\">\u3002<\/span><\/p>\n<p>#include &lt;bits\/stdc&#043;&#043;.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int MOD&#061;1e6&#043;7;<br \/>\nconst int N&#061;1e2&#043;5;<br \/>\nint dp[N][N];<br \/>\nint a[N];<\/p>\n<p>int main() {<br \/>\n    int n,m;<br \/>\n    cin&gt;&gt;n&gt;&gt;m;<br \/>\n    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) {<br \/>\n        cin&gt;&gt;a[i];<br \/>\n    }<\/p>\n<p>    dp[0][0]&#061;1;<br \/>\n    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) {<br \/>\n        for(int j&#061;0; j&lt;&#061;m; j&#043;&#043;) {<br \/>\n            for(int k&#061;0; k&lt;&#061;a[i] &amp;&amp; k&lt;&#061;j; k&#043;&#043;) {<br \/>\n                dp[i][j]&#061;(dp[i][j]&#043;dp[i-1][j-k])%MOD;<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n    cout&lt;&lt;dp[n][m]&lt;&lt;endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\/*<br \/>\nin:<br \/>\n2 4<br \/>\n3 2<br \/>\nout:<br \/>\n2<br \/>\n*\/ <\/p>\n<p><span style=\"color:#0d0016\">\u2705 \u6280\u5de7 2&#xff1a;\u4ec5\u4fdd\u7559\u5fc5\u8981\u4fe1\u606f&#xff0c;\u5254\u9664\u5197\u4f59\u5185\u5bb9 \u72b6\u6001\u4e0b\u6807\u6570\u91cf\u8d8a\u5c11\u8d8a\u597d&#xff0c;\u7ef4\u5ea6\u8fc7\u591a\u4f1a\u9020\u6210\u65f6\u95f4\u3001\u7a7a\u95f4\u590d\u6742\u5ea6\u6025\u5267\u4e0a\u5347\u3002 \u65e0\u9700\u8bb0\u5f55\u5168\u90e8\u5386\u53f2\u9009\u62e9&#xff0c;\u53ea\u4fdd\u5b58\u4f1a\u5f71\u54cd\u540e\u7eed\u51b3\u7b56\u7684\u5173\u952e\u4fe1\u606f\u3002\u5176\u672c\u8d28\u5c31\u662f\u4fdd\u8bc1\u65e0\u540e\u6548\u6027&#xff1a;\u53ea\u8981\u77e5\u9053\u5f53\u524d\u72b6\u6001&#xff0c;\u5c31\u53ef\u4ee5\u63a8\u5bfc\u51fa\u540e\u7eed\u7ed3\u679c&#xff0c;\u4e0d\u5fc5\u5173\u5fc3\u62b5\u8fbe\u8be5\u72b6\u6001\u7684\u8def\u5f84\u3002 \u4f8b&#xff1a;AcWing 895&#xff1a;\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217&#xff08;https:\/\/blog.csdn.net\/hnjzsyjyj\/article\/details\/149798835&#xff09; &#xff08;1&#xff09;\u9519\u8bef\u5b9a\u4e49&#xff1a;dp[i] \u5b58\u50a8\u524d i \u4e2a\u6570\u7684\u5168\u90e8\u5b50\u5e8f\u5217&#xff08;\u4fe1\u606f\u5197\u4f59&#xff09; &#xff08;2&#xff09;\u6b63\u786e\u5b9a\u4e49&#xff1a;<\/span><span style=\"color:#fe2c24\">dp[i] \u4ee3\u8868\u4ee5\u7b2c i \u4e2a\u5143\u7d20\u4f5c\u4e3a\u7ed3\u5c3e\u7684\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217\u957f\u5ea6<\/span> <span style=\"color:#0d0016\">\u53ea\u4fdd\u7559\u7ed3\u5c3e\u8fd9\u4e2a\u5173\u952e\u7ea6\u675f&#xff0c;\u524d\u9762\u7684\u9009\u53d6\u8fc7\u7a0b\u65e0\u9700\u8bb0\u5f55\u3002<\/span><\/p>\n<p>#include &lt;bits\/stdc&#043;&#043;.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int maxn&#061;1e3&#043;5;<br \/>\nint a[maxn],dp[maxn];<br \/>\nint ans&#061;INT_MIN;<br \/>\nint n;<\/p>\n<p>int main() {<br \/>\n    cin&gt;&gt;n;<br \/>\n    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) cin&gt;&gt;a[i];<\/p>\n<p>    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) {<br \/>\n        dp[i]&#061;1;<br \/>\n        for(int j&#061;1; j&lt;i; j&#043;&#043;) {<br \/>\n            if(a[j]&lt;a[i]) dp[i]&#061;max(dp[i],dp[j]&#043;1);<br \/>\n        }<br \/>\n        ans&#061;max(ans,dp[i]);<br \/>\n    }<\/p>\n<p>    cout&lt;&lt;ans&lt;&lt;endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\/*<br \/>\nin:<br \/>\n7<br \/>\n3 1 2 1 8 5 6<\/p>\n<p>out:<br \/>\n4<br \/>\n*\/ <\/p>\n<p>\u2705 \u6280\u5de7 3&#xff1a;\u76ee\u6807\u5bf9\u9f50&#xff0c;\u6240\u6c42\u5373\u6240\u5b58 \u9898\u76ee\u8981\u6c42\u6c42\u89e3\u4ec0\u4e48&#xff0c;dp \u6570\u7ec4\u7684\u503c\u5c31\u4ee3\u8868\u4ec0\u4e48\u3002 &#8211; \u6c42\u65b9\u6848\u603b\u6570&#xff1a;dp \u5b58\u50a8\u65b9\u6848\u6570\u91cf &#8211; \u6c42\u6700\u5927 \/ \u6700\u5c0f\u503c&#xff1a;dp \u5b58\u50a8\u6700\u4f18\u4ef7\u503c &#8211; \u6c42\u6700\u5c11\u64cd\u4f5c\u6b21\u6570&#xff1a;dp \u5b58\u50a8\u6700\u5c0f\u6b65\u6570 \u4f8b&#xff1a;\u6d1b\u8c37 P1002&#xff1a;\u8fc7\u6cb3\u5352&#xff08;https:\/\/blog.csdn.net\/hnjzsyjyj\/article\/details\/138806060<span style=\"color:#0d0016\">&#xff09; \u72b6\u6001&#xff1a;<\/span><span style=\"color:#fe2c24\">\u8bbe\u00a0dpf(i,j) \u8868\u793a\u4ece (0,0) \u8d70\u5230 (i,j) \u7684\u8def\u5f84\u7684\u6761\u6570<\/span><span style=\"color:#0d0016\">\u3002 \u5982\u679c i&#061;0 \u4e14 j&#061;0&#xff0c;\u5219 dp[i][j]&#061;1&#xff1b; \u5426\u5219&#xff0c;\u5982\u679c i&#061;0&#xff0c;\u5219 dp[i][j]&#061;dp[i][j\u22121]&#xff1b; \u5426\u5219&#xff0c;\u5982\u679c j&#061;0&#xff0c;\u5219 dp[i][j]&#061;dp[i\u22121][j]&#xff1b; \u5426\u5219&#xff0c;dp[i][j]&#061;dp[i\u22121][j]&#043;dp[i][j\u22121]\u3002<\/span><\/p>\n<p>#include &lt;bits\/stdc&#043;&#043;.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>typedef long long LL;<br \/>\nconst int maxn&#061;25;<br \/>\nbool st[maxn][maxn];<br \/>\nLL dp[maxn][maxn];<\/p>\n<p>int dx[]&#061; {0,-2,-2,-1,-1,1,1,2,2};<br \/>\nint dy[]&#061; {0,-1,1,-2,2,-2,2,-1,1};<\/p>\n<p>int n,m,x,y;<\/p>\n<p>int main() {<br \/>\n    cin&gt;&gt;n&gt;&gt;m&gt;&gt;x&gt;&gt;y;<br \/>\n    for(int i&#061;0; i&lt;9; i&#043;&#043;) {<br \/>\n        int nx&#061;x&#043;dx[i];<br \/>\n        int ny&#061;y&#043;dy[i];<br \/>\n        if(nx&gt;&#061;0 &amp;&amp; nx&lt;&#061;n &amp;&amp; ny&gt;&#061;0 &amp;&amp; ny&lt;&#061;m)<br \/>\n            st[nx][ny]&#061;true;<br \/>\n    }<\/p>\n<p>    for(int i&#061;0; i&lt;&#061;n; i&#043;&#043;)<br \/>\n        for(int j&#061;0; j&lt;&#061;m; j&#043;&#043;) {<br \/>\n            if(st[i][j]) dp[i][j]&#061;0;<br \/>\n            else if(i&#061;&#061;0 &amp;&amp; j&#061;&#061;0) dp[i][j]&#061;1;<br \/>\n            else if(i&#061;&#061;0) dp[i][j]&#061;dp[i][j-1];<br \/>\n            else if(j&#061;&#061;0) dp[i][j]&#061;dp[i-1][j];<br \/>\n            else dp[i][j]&#061;dp[i-1][j]&#043;dp[i][j-1];<br \/>\n        }<\/p>\n<p>    cout&lt;&lt;dp[n][m];<br \/>\n}<\/p>\n<p>\/*<br \/>\nin:<br \/>\n8 6 0 4<br \/>\nout:<br \/>\n1617<br \/>\n&#8212;&#8212;-<br \/>\nin:<br \/>\n6 6 3 2<br \/>\nout:<br \/>\n17<br \/>\n*\/ <\/p>\n<p><span style=\"color:#0d0016\">\u2705 \u6280\u5de7 4&#xff1a;\u4f18\u5148\u91c7\u7528<\/span><span style=\"color:#fe2c24\">\u524d\u7f00\u89c6\u89d2<\/span><span style=\"color:#0d0016\">&#xff08;\u80cc\u5305\u3001\u7ebf\u6027 DP \u9996\u9009&#xff09; \u7ade\u8d5b\u91cc\u5927\u90e8\u5206\u7ebf\u6027 DP\u3001\u80cc\u5305\u95ee\u9898&#xff0c;\u4f18\u5148\u4f7f\u7528\u201c<\/span><span style=\"color:#fe2c24\">\u524d\u7f00\u89c6\u89d2<\/span><span style=\"color:#0d0016\">\u201d\u5b9a\u4e49\u72b6\u6001&#xff1a; dp[i] \u8868\u793a\u201c\u524d i \u4e2a\u7269\u54c1\u5168\u90e8\u51b3\u7b56\u5b8c\u6210\u540e\u7684\u7ed3\u679c\u201d\u3002 \u542b\u4e49\u662f\u524d i \u4e2a\u5df2\u7ecf\u5904\u7406\u5b8c\u6bd5&#xff0c;\u800c\u975e\u51c6\u5907\u5904\u7406\u7b2c i \u4e2a\u3002\u8be5\u89c6\u89d2\u5929\u7136\u9002\u914d\u300c\u6700\u540e\u4e00\u6b65\u5206\u6790\u6cd5\u300d&#xff0c;\u4fbf\u4e8e\u63a8\u5bfc\u72b6\u6001\u8f6c\u79fb\u65b9\u7a0b\u3002 \u4f8b&#xff1a;\u6d1b\u8c37 P2842&#xff1a;\u7eb8\u5e01\u95ee\u9898 1&#xff08;https:\/\/blog.csdn.net\/hnjzsyjyj\/article\/details\/166896877&#xff09; \u72b6\u6001&#xff1a;<\/span><span style=\"color:#fe2c24\">dp[i][j] \u8868\u793a\u8003\u8651\u524d i \u79cd\u7eb8\u5e01&#xff0c;\u51d1\u51fa\u91d1\u989d j&#xff0c;\u6240\u9700\u8981\u7684\u6700\u5c11\u7eb8\u5e01\u5f20\u6570<\/span><span style=\"color:#0d0016\">\u3002 \u8f6c\u79fb&#xff1a;dp[i][j]&#061;min(dp[i-1][j], dp[i][j-ai]&#043;1) \u8fb9\u754c&#xff1a;dp[0][0]&#061;0&#xff0c;\u5176\u4f59 dp[0][j]&#061;inf\u3002<\/span><\/p>\n<p>#include &lt;bits\/stdc&#043;&#043;.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int inf&#061;0x3f3f3f3f;<br \/>\nconst int N&#061;1e3&#043;5;<br \/>\nconst int W&#061;1e4&#043;5;<br \/>\nint dp[N][W];<br \/>\nint a[N];<\/p>\n<p>int main() {<br \/>\n    int n,w;<br \/>\n    cin&gt;&gt;n&gt;&gt;w;<br \/>\n    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) {<br \/>\n        cin&gt;&gt;a[i];<br \/>\n    }<\/p>\n<p>    memset(dp,inf,sizeof dp);<br \/>\n    dp[0][0]&#061;0;<br \/>\n    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) {<br \/>\n        for(int j&#061;0; j&lt;&#061;w; j&#043;&#043;) {<br \/>\n            dp[i][j]&#061;dp[i-1][j];<br \/>\n            if(j&gt;&#061;a[i]) {<br \/>\n                dp[i][j]&#061;min(dp[i][j],dp[i][j-a[i]]&#043;1);<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n    cout&lt;&lt;dp[n][w]&lt;&lt;endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\/*<br \/>\nin:<br \/>\n6 15<br \/>\n1 5 10 20 50 100<\/p>\n<p>out:<br \/>\n2<br \/>\n*\/ <\/p>\n<p><span style=\"color:#0d0016\">\u2705 \u6280\u5de7 5&#xff1a;\u9047\u5230\u5206\u652f\u9009\u62e9&#xff0c;\u589e\u52a0 0\/1 \u6807\u8bb0\u7ef4\u5ea6 \u5f53\u5355\u7eaf\u4e00\u7ef4\u72b6\u6001\u65e0\u6cd5\u63cf\u8ff0\u5f53\u524d\u5c40\u9762\u3001\u5b58\u5728\u540e\u6548\u6027\u65f6&#xff0c;\u589e\u52a0\u4e00\u7ef4 0\/1 \u6807\u8bb0&#xff0c;\u8bb0\u5f55\u4e8c\u5143\u5f00\u5173\u72b6\u6001&#xff0c;\u628a\u4e24\u79cd\u4e0d\u540c\u5c40\u9762\u5206\u5f00\u5b58\u50a8&#xff0c;\u6d88\u9664\u540e\u6548\u6027\u3002 \u4f8b&#xff1a;AcWing 1055&#xff1a;\u80a1\u7968\u4e70\u5356 II&#xff08;https:\/\/blog.csdn.net\/hnjzsyjyj\/article\/details\/166903341&#xff09; \u25cf \u72b6\u6001\u5b9a\u4e49<\/span> <span style=\"color:#fe2c24\">dp[i][0]&#xff1a;\u7b2c i \u5929\u7ed3\u675f\u65f6&#xff0c;\u4e0d\u6301\u6709\u80a1\u7968\u7684\u6700\u5927\u6536\u76ca dp[i][1]&#xff1a;\u7b2c i \u5929\u7ed3\u675f\u65f6&#xff0c;\u6301\u6709\u80a1\u7968\u7684\u6700\u5927\u6536\u76ca<\/span> <span style=\"color:#0d0016\">\u25cf \u8f6c\u79fb\u5206\u6790&#xff08;\u6700\u540e\u4e00\u6b65\u5206\u6790\u6cd5&#xff09; 1. dp[i][0]&#xff1a;\u7b2c i \u5929\u4e0d\u6301\u6709\u80a1\u7968\u3002\u4e24\u79cd\u6765\u6e90&#xff1a; \u00a0 \u00a0&#8211; \u524d\u4e00\u5929\u672c\u6765\u5c31\u4e0d\u6301\u6709&#xff0c;\u4eca\u5929\u4ec0\u4e48\u90fd\u4e0d\u505a&#xff1a;dp[i-1][0] \u00a0 \u00a0&#8211; \u524d\u4e00\u5929\u6301\u6709\u80a1\u7968&#xff0c;\u4eca\u5929\u5356\u51fa&#xff1a;dp[i-1][1] &#043; a[i] dp[i][0]&#061;max(dp[i-1][0],dp[i-1][1]&#043;a[i]) 2. dp[i][1]&#xff1a;\u7b2c i \u5929\u6301\u6709\u80a1\u7968\u3002\u4e24\u79cd\u6765\u6e90&#xff1a; \u00a0 \u00a0&#8211; \u524d\u4e00\u5929\u5df2\u7ecf\u6301\u6709&#xff0c;\u4eca\u5929\u4e0d\u52a8&#xff1a;dp[i-1][1] \u00a0 \u00a0&#8211; \u524d\u4e00\u5929\u65e0\u80a1\u7968&#xff0c;\u4eca\u5929\u4e70\u5165&#xff1a;dp[i-1][0]-a[i] dp[i][1]&#061;max(dp[i-1][1],dp[i-1][0]-a[i]) \u25cf \u8fb9\u754c&#xff1a; dp[0][0]&#061;0&#xff1a;\u7b2c 0 \u5929&#xff0c;\u65e0\u80a1\u7968&#xff0c;\u6536\u76ca 0 dp[0][1]&#061;-inf&#xff1a;\u7b2c 0 \u5929\u4e0d\u53ef\u80fd\u6301\u6709\u80a1\u7968&#xff0c;\u8d1f\u65e0\u7a77&#xff08;\u975e\u6cd5\u72b6\u6001&#xff09; \u25cf \u6700\u7ec8\u7b54\u6848&#xff1a;dp[n][0]&#xff0c;\u6700\u540e\u4e00\u5929\u4e00\u5b9a\u4e0d\u6301\u6709\u80a1\u7968&#xff08;\u5356\u51fa\u624d\u5151\u73b0\u5229\u6da6&#xff09;<\/span><\/p>\n<p>#include &lt;bits\/stdc&#043;&#043;.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int inf&#061;0x3f3f3f3f;<br \/>\nconst int N&#061;1e5&#043;5;<br \/>\nint dp[N][2];<br \/>\nint a[N];<\/p>\n<p>int main() {<br \/>\n    int n;<br \/>\n    cin&gt;&gt;n;<br \/>\n    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) {<br \/>\n        cin&gt;&gt;a[i];<br \/>\n    }<\/p>\n<p>    dp[0][0]&#061;0, dp[0][1]&#061;-inf;<br \/>\n    for(int i&#061;1; i&lt;&#061;n; i&#043;&#043;) {<br \/>\n        dp[i][0]&#061;max(dp[i-1][0],dp[i-1][1]&#043;a[i]);<br \/>\n        dp[i][1]&#061;max(dp[i-1][1],dp[i-1][0]-a[i]);<br \/>\n    }<br \/>\n    cout&lt;&lt;dp[n][0]&lt;&lt;endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\/*<br \/>\nin:<br \/>\n6<br \/>\n7 1 5 3 6 4<\/p>\n<p>out:<br \/>\n7<br \/>\n*\/ <\/p>\n<p><span style=\"color:#0d0016\">\u2705 \u6280\u5de7 6&#xff1a;\u6821\u9a8c&#xff1a;\u7528\u65e0\u540e\u6548\u6027\u53cd\u5411\u68c0\u9a8c\u72b6\u6001\u662f\u5426\u5408\u683c \u68c0\u9a8c\u6807\u51c6&#xff1a;\u7ed9\u5b9a\u5f53\u524d\u72b6\u6001&#xff0c;\u80fd\u5426\u72ec\u7acb\u8ba1\u7b97\u540e\u7eed\u6240\u6709\u7ed3\u679c&#xff0c;\u65e0\u9700\u5173\u6ce8\u62b5\u8fbe\u8be5\u72b6\u6001\u7684\u8def\u5f84&#xff1f; &#8211; \u53ef\u4ee5&#xff1a;\u72b6\u6001\u5b9a\u4e49\u5408\u683c&#xff1b; &#8211; \u4e0d\u884c&#xff1a;\u72b6\u6001\u7f3a\u5c11\u5173\u952e\u4fe1\u606f&#xff0c;\u9700\u8981\u8865\u5145\u7ef4\u5ea6\u3002  \u3010\u52a8\u6001\u89c4\u5212\u72b6\u6001\u8f6c\u79fb\u65b9\u7a0b\u63a8\u5bfc\u7684\u7ecf\u5178\u65b9\u6cd5\u3011 \u2705 <\/span><span style=\"color:#fe2c24\">\u65b9\u6cd5 1&#xff1a;\u6700\u540e\u4e00\u6b65\u6cd5&#xff08;\u63a8\u8350&#xff09;<\/span><span style=\"color:#0d0016\">&#xff1a;https:\/\/www.bilibili.com\/video\/BV1xb411e7ww \u6700\u540e\u4e00\u6b65\u6cd5&#xff08;\u672b\u7aef\u5206\u6790\u6cd5&#xff09;&#xff0c;\u4e0d\u53bb\u4ece\u5934\u6a21\u62df\u6574\u4e2a\u8fc7\u7a0b&#xff0c;\u53ea\u770b\u7ed3\u5c3e\u7684\u51b3\u7b56\u3002\u5373&#xff1a;\u5148\u5b9a\u4e49\u72b6\u6001&#xff0c;\u518d\u601d\u8003 \u201c\u6700\u540e\u4e00\u6b65\u53d1\u751f\u4e86\u4ec0\u4e48\u201d&#xff0c;\u6700\u540e\u5199\u51fa\u8f6c\u79fb\u3002<\/span><span style=\"color:#fe2c24\">\u6700\u540e\u4e00\u6b65\u6cd5\u662f\u7ade\u8d5b\u6700\u5e38\u7528\u3001\u4e0a\u624b\u6700\u5feb\u7684\u65b9\u6cd5<\/span><span style=\"color:#0d0016\">\u3002  \u2705 \u65b9\u6cd5 2&#xff1a;\u5b50\u96c6\u5212\u5206\u6cd5&#xff08;\u533a\u95f4 DP&#xff0c;\u77f3\u5b50\u5408\u5e76\u3001\u62ec\u53f7\u5339\u914d&#xff09; \u533a\u95f4 DP \u5904\u7406\u4e00\u6bb5\u8fde\u7eed\u533a\u95f4\u4e0a\u7684\u95ee\u9898&#xff0c;\u6838\u5fc3\u601d\u8def\u4e3a\u201c\u628a\u4e00\u4e2a\u5927\u7684\u8fde\u7eed\u533a\u95f4&#xff0c;\u901a\u8fc7\u4e00\u6b21\u5206\u5272\u62c6\u6210\u5de6\u53f3\u4e24\u6bb5\u4e92\u4e0d\u5e72\u6270\u7684\u5b50\u533a\u95f4&#xff1b;\u5927\u533a\u95f4\u7684\u6700\u4f18\u89e3&#xff0c;\u7531\u8fd9\u4e24\u4e2a\u5b50\u533a\u95f4\u7684\u7ed3\u679c\u5408\u5e76\u8ba1\u7b97\u5f97\u5230\u201d\u3002 \u6ce8\u610f&#xff1a;\u6bcf\u6b21\u5206\u5272\u53ea\u5207\u4e00\u5200&#xff0c;\u5f97\u5230\u4e24\u4e2a\u5b50\u533a\u95f4&#xff1b;\u5b50\u533a\u95f4\u53ef\u4ee5\u7ee7\u7eed\u9012\u5f52\u5206\u5272&#xff0c;\u4e0d\u65ad\u62c6\u6210\u66f4\u5c0f\u7684\u4e24\u6bb5&#xff0c;\u76f4\u5230\u533a\u95f4\u957f\u5ea6\u4e3a 1&#xff08;\u8fb9\u754c&#xff09;\u3002 \u72b6\u6001\u5b9a\u4e49&#xff1a;dp[l][r] \u8868\u793a\u533a\u95f4 [l,r] \u5185\u7684\u6700\u4f18\u89e3\u3002 \u6211\u4eec\u679a\u4e3e\u5206\u5272\u70b9 k&#xff08;l\u2264k&lt;r&#xff09;&#xff0c;\u628a\u533a\u95f4 [l,r] \u5728 k \u7684\u4f4d\u7f6e\u5207\u5f00&#xff0c;\u5f97\u5230\u5de6\u533a\u95f4 [l,k]\u3001\u53f3\u533a\u95f4 [k&#043;1,r]\u3002\u5de6\u53f3\u5b50\u533a\u95f4\u72ec\u7acb\u6c42\u89e3&#xff0c;\u518d\u5408\u5e76\u7ed3\u679c\u3002\u904d\u5386\u5168\u90e8\u5408\u6cd5\u5206\u5272\u70b9&#xff0c;\u9009\u51fa\u6700\u4f18\u503c\u3002 \u5bf9\u6240\u6709\u5408\u6cd5\u5206\u5272\u70b9\u53d6\u6700\u4f18\u503c&#xff0c;\u5f97\u5230\u5927\u533a\u95f4\u7b54\u6848&#xff1a;dp[l][r]&#061;min(dp[l][k]&#043;dp[k&#043;1][r])  \u2705 \u65b9\u6cd5 3&#xff1a;\u589e\u91cf\u9012\u63a8\u6cd5&#xff08;\u7b80\u5355\u7ebf\u6027 DP&#xff0c;\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217 LIS&#xff09; \u589e\u91cf\u9012\u63a8\u6cd5\u9002\u7528\u4e8e\u7ebf\u6027\u5e8f\u5217\u95ee\u9898&#xff0c;\u6838\u5fc3\u601d\u8def\u4e3a\u201c\u4ece\u5de6\u5f80\u53f3\u9010\u4e2a\u65b0\u589e\u5143\u7d20&#xff0c;\u4ee5\u5f53\u524d\u5143\u7d20\u4f5c\u4e3a\u5b50\u5e8f\u5217\u7684\u7ed3\u5c3e&#xff0c;\u5728\u524d\u9762\u5df2\u7ecf\u6c42\u89e3\u5b8c\u6210\u7684\u5b50\u95ee\u9898\u57fa\u7840\u4e0a&#xff0c;\u66f4\u65b0\u5f53\u524d\u72b6\u6001\u201d\u3002 \u72b6\u6001\u5b9a\u4e49&#xff1a;dp[i] \u8868\u793a\u4ee5\u5e8f\u5217\u4e2d\u7b2c i \u4e2a\u5143\u7d20\u4f5c\u4e3a\u7ed3\u5c3e\u7684\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217\u7684\u957f\u5ea6\u3002  \u2705 \u95eb\u6c0f DP \u5206\u6790\u6cd5&#xff1a;https:\/\/www.bilibili.com\/video\/BV1X741127ZM<\/span>        \u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7\u3011 &gt;\u00a0\u6838\u5fc3\u539f\u5219&#xff1a;\u72b6\u6001\u9700\u8981\u5b8c\u6574\u63cf\u8ff0\u5f53\u524d\u5c40\u9762&#xff0c;\u6ee1\u8db3\u201c\u65e0\u540e\u6548\u6027\u201d&#xff08;\u8fc7\u5f80\u7684\u9009\u62e9\u4e0d\u4f1a\u5e72\u6270\u540e\u7eed\u51b3\u7b56&#xff09;&#xff0c;\u540c\u65f6\u5b50\u95ee\u9898\u80fd\u591f\u91cd\u590d\u4f7f\u7528\u3002 &gt; \u4e00\u53e5\u8bdd\u6982\u62ec&#xff1a;\u72b6\u6001\u8bb0\u5f55\u300c\u5df2\u7ecf\u5b8c\u6210\u7684\u64cd\u4f5c\u3001\u5269\u4f59\u7684\u7ea6\u675f\u6761\u4ef6\u300d&#xff0c;\u4e0d\u4fdd\u5b58\u5b8c\u6574\u8fc7\u7a0b\u7ec6\u8282\u3002  \u2705 \u6280\u5de7 1&#xff1a;\u63d0\u53d6\u9898\u5e72\u7ea6\u675f&#xff0c;\u76f4\u63a5\u4f5c\u4e3a\u72b6\u6001\u53c2\u6570&#xff08;\u6700\u5b9e\u7528&#xff09; \u62ff\u5230\u9898\u76ee&#xff0c;\u5148\u63d0\u53d6\u9898\u5e72\u4e2d\u7684\u9650\u5236<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2865],"topic":[],"class_list":["post-111447","post","type-post","status-publish","format-standard","hentry","category-server","tag-2865"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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:\/\/www.wsisp.com\/helps\/111447.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7\u3011 &gt;\u00a0\u6838\u5fc3\u539f\u5219&#xff1a;\u72b6\u6001\u9700\u8981\u5b8c\u6574\u63cf\u8ff0\u5f53\u524d\u5c40\u9762&#xff0c;\u6ee1\u8db3\u201c\u65e0\u540e\u6548\u6027\u201d&#xff08;\u8fc7\u5f80\u7684\u9009\u62e9\u4e0d\u4f1a\u5e72\u6270\u540e\u7eed\u51b3\u7b56&#xff09;&#xff0c;\u540c\u65f6\u5b50\u95ee\u9898\u80fd\u591f\u91cd\u590d\u4f7f\u7528\u3002 &gt; \u4e00\u53e5\u8bdd\u6982\u62ec&#xff1a;\u72b6\u6001\u8bb0\u5f55\u300c\u5df2\u7ecf\u5b8c\u6210\u7684\u64cd\u4f5c\u3001\u5269\u4f59\u7684\u7ea6\u675f\u6761\u4ef6\u300d&#xff0c;\u4e0d\u4fdd\u5b58\u5b8c\u6574\u8fc7\u7a0b\u7ec6\u8282\u3002 \u2705 \u6280\u5de7 1&#xff1a;\u63d0\u53d6\u9898\u5e72\u7ea6\u675f&#xff0c;\u76f4\u63a5\u4f5c\u4e3a\u72b6\u6001\u53c2\u6570&#xff08;\u6700\u5b9e\u7528&#xff09; \u62ff\u5230\u9898\u76ee&#xff0c;\u5148\u63d0\u53d6\u9898\u5e72\u4e2d\u7684\u9650\u5236\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/111447.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-30T23:51:05+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/111447.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/111447.html\",\"name\":\"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-30T23:51:05+00:00\",\"dateModified\":\"2026-09-30T23:51:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/111447.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/111447.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/111447.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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:\/\/www.wsisp.com\/helps\/111447.html","og_locale":"zh_CN","og_type":"article","og_title":"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7\u3011 &gt;\u00a0\u6838\u5fc3\u539f\u5219&#xff1a;\u72b6\u6001\u9700\u8981\u5b8c\u6574\u63cf\u8ff0\u5f53\u524d\u5c40\u9762&#xff0c;\u6ee1\u8db3\u201c\u65e0\u540e\u6548\u6027\u201d&#xff08;\u8fc7\u5f80\u7684\u9009\u62e9\u4e0d\u4f1a\u5e72\u6270\u540e\u7eed\u51b3\u7b56&#xff09;&#xff0c;\u540c\u65f6\u5b50\u95ee\u9898\u80fd\u591f\u91cd\u590d\u4f7f\u7528\u3002 &gt; \u4e00\u53e5\u8bdd\u6982\u62ec&#xff1a;\u72b6\u6001\u8bb0\u5f55\u300c\u5df2\u7ecf\u5b8c\u6210\u7684\u64cd\u4f5c\u3001\u5269\u4f59\u7684\u7ea6\u675f\u6761\u4ef6\u300d&#xff0c;\u4e0d\u4fdd\u5b58\u5b8c\u6574\u8fc7\u7a0b\u7ec6\u8282\u3002 \u2705 \u6280\u5de7 1&#xff1a;\u63d0\u53d6\u9898\u5e72\u7ea6\u675f&#xff0c;\u76f4\u63a5\u4f5c\u4e3a\u72b6\u6001\u53c2\u6570&#xff08;\u6700\u5b9e\u7528&#xff09; \u62ff\u5230\u9898\u76ee&#xff0c;\u5148\u63d0\u53d6\u9898\u5e72\u4e2d\u7684\u9650\u5236","og_url":"https:\/\/www.wsisp.com\/helps\/111447.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-30T23:51:05+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/111447.html","url":"https:\/\/www.wsisp.com\/helps\/111447.html","name":"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-30T23:51:05+00:00","dateModified":"2026-09-30T23:51:05+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/111447.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/111447.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/111447.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u52a8\u6001\u89c4\u5212\u4e4b\u72b6\u6001\u5b9a\u4e49\u7684\u6280\u5de7"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/111447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=111447"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/111447\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=111447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=111447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=111447"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=111447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}