{"id":24,"date":"2020-03-21T22:43:10","date_gmt":"2020-03-21T14:43:10","guid":{"rendered":"http:\/\/47.103.223.234:100\/?p=24"},"modified":"2021-03-28T12:21:13","modified_gmt":"2021-03-28T04:21:13","slug":"%e5%b0%8f%e5%87%bd%e6%95%b0%e7%9f%a5%e8%af%86%e7%82%b9","status":"publish","type":"post","link":"http:\/\/www.zyhcoding.club\/index.php\/2020\/03\/21\/%e5%b0%8f%e5%87%bd%e6%95%b0%e7%9f%a5%e8%af%86%e7%82%b9\/","title":{"rendered":"\u5c0f\u51fd\u6570\u77e5\u8bc6\u70b9"},"content":{"rendered":"<h5>gotoxy(int x,int y)\u51fd\u6570\u7684\u4f7f\u7528\u3002<\/h5>\n<p>\u56e0\u4e3aC++\u6807\u51c6\u5e93\u4e2d\u6ca1\u6709\u8fd9\u4e2a\u51fd\u6570\uff0c\u4f7f\u7528\u7684\u65f6\u5019\u9700\u8981\u81ea\u5df1\u5b9a\u4e49  <\/p>\n<pre><code class=\"language-c++\">void gotoxy(int x, int y) {\n    COORD pos;\n    pos.X = x,pos.Y = y;\n    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);\/\/ \u83b7\u53d6\u6807\u51c6\u8f93\u51fa\u8bbe\u5907\u53e5\u67c4\n    SetConsoleCursorPosition(hOut, pos);\/\/\u4e24\u4e2a\u53c2\u6570\u5206\u522b\u662f\u6307\u5b9a\u54ea\u4e2a\u7a97\u4f53\uff0c\u5177\u4f53\u4f4d\u7f6e\n}<\/code><\/pre>\n<p>\u5728\u8f93\u51fa\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u628a\u5149\u6807\u79fb\u52a8\u5230\u4efb\u610f\u4f4d\u7f6e\uff0c\u4f46\u8981\u6ce8\u610fx\uff0cy\u7684\u8303\u56f4\uff1a\u5728DOS\u8f93\u51fa\u7a97\u53e3\u4e2d\uff0c\u4ece\u5de6\u5411\u53f3\u4e3ax\u65b9\u5411\uff0c\u4e14\u4e0b\u6807\u4ece0\u5f00\u59cb\uff1b\u7528\u4e0a\u5411\u4e0b\u4e3ay\u65b9\u5411\uff0c\u4e0b\u6807\u4ece0\u5f00\u59cb\u3002<br \/>\n\u5728\u505a\u4e00\u4e9b\u6742\u9898\u9700\u8981\u5f88\u70e6\u4eba\u7684\u8f93\u51fa\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u51fd\u6570\u662f\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\uff01<br \/>\n\u614e\u7528\uff01\uff01\uff01<\/p>\n<h5>\u5168\u6392\u5217next_permutation\u51fd\u6570<\/h5>\n<p>next_permutation(begin,end);<br \/>\nbegin\uff0cend\u53ef\u4ee5\u662f\u6570\u7ec4\u7684\u8d77\u59cb\uff0c\u7ec8\u6b62\u5730\u5740\uff0c\u4e5f\u53ef\u4ee5\u662fstring\u7684\u8d77\u59cb\uff0c\u7ec8\u6b62\u8fed\u4ee3\u5668\uff0c\u4e5f\u53ef\u4ee5\u662fvector\u7684\u8d77\u59cb\uff0c\u7ec8\u6b62\u8fed\u4ee3\u5668\u3002<br \/>\n\u51fd\u6570\u4f1a\u6539\u53d8\u5143\u5bb9\u5668\u7684\u503c\u7684\u987a\u5e8f\uff0c\u4f7f\u5176\u53d8\u6210\u539f\u6392\u5217\u7684\u4e0b\u4e00\u4e2a\u6392\u5217\uff0c\u5982\u679c\u539f\u5e8f\u5217\u8fd8\u5b58\u5728\u4e0b\u4e00\u4e2a\u6392\u5217\uff0c\u5219\u51fd\u6570\u8fd4\u56de0\uff1b\u5426\u5219\u8fd4\u56de1\u3002\u5373\u539f\u5e8f\u5217\u9012\u51cf\u65f6\uff0c\u51fd\u6570\u8fd4\u56de1.<br \/>\n<strong>\u6ce8\u610f\uff1anext_permutation()\u51fd\u6570\u662f\u81ea\u52a8\u53bb\u91cd\u7684<\/strong><br \/>\n<strong>\u4e0e\u4e0b\u4e00\u4e2a\u5168\u6392\u5217\u5bf9\u5e94\u7684\u662f\u4e0a\u4e00\u4e2a\u5168\u6392\u5217\u51fd\u6570prev_permutation().<\/strong><br \/>\n\u8fd8\u6709leetcode\u91cc\uff0c\u4f7f\u7528sort\u51fd\u6570\u65f6\uff0c\u82e5\u8981\u91cd\u65b0\u5b9a\u897f\u6392\u5e8f\u65b9\u5f0f\uff0ccmp\u51fd\u6570\u5982\u679c\u5199\u5728\u7c7b\u91cc\u9762\u7684\u8bdd\u4e00\u5b9a\u8981\u52a0\u4e0astatic\u5173\u952e\u5b57\uff0c\u7c7b\u5916\u53ef\u4e0d\u52a0\u3002<br \/>\n\u56e0\u4e3a\uff1a<strong><em>\u975e\u9759\u6001\u6210\u5458\u51fd\u6570\u662f\u4f9d\u8d56\u4e8e\u5177\u4f53\u5bf9\u8c61\u7684\uff0c\u800cstd::sort\u8fd9\u7c7b\u51fd\u6570\u662f\u5168\u5c40\u7684\uff0c\u56e0\u6b64\u65e0\u6cd5\u518dsort\u4e2d\u8c03\u7528\u975e\u9759\u6001\u6210\u5458\u51fd\u6570\u3002\u9759\u6001\u6210\u5458\u51fd\u6570\u6216\u8005\u5168\u5c40\u51fd\u6570\u662f\u4e0d\u4f9d\u8d56\u4e8e\u5177\u4f53\u5bf9\u8c61\u7684, \u53ef\u4ee5\u72ec\u7acb\u8bbf\u95ee\uff0c\u65e0\u987b\u521b\u5efa\u4efb\u4f55\u5bf9\u8c61\u5b9e\u4f8b\u5c31\u53ef\u4ee5\u8bbf\u95ee\u3002\u540c\u65f6\u9759\u6001\u6210\u5458\u51fd\u6570\u4e0d\u53ef\u4ee5\u8c03\u7528\u7c7b\u7684\u975e\u9759\u6001\u3002\u6240\u4ee5\u8981\u52a0\u4e0astatic\u5173\u952e\u5b57\u3002<\/em><\/strong><br \/>\n<a href=\"https:\/\/leetcode-cn.com\/problems\/permutations\/\">leetcode 46.permutation<\/a><\/p>\n<pre><code class=\"language-c++\">class Solution {\npublic:\n    vector&lt;vector&lt;int&gt;&gt; permute(vector&lt;int&gt;&amp; nums) {\n        sort(nums.begin(),nums.end());\n        vector&lt;vector&lt;int&gt;&gt; ans;\n        ans.push_back(nums);\n        while (next_permutation(nums.begin(),nums.end()))\n            ans.push_back(nums);\n        return ans;\n    }\n};<\/code><\/pre>\n<h5>string\u7c7b += \u548c + \u7684\u533a\u522b<\/h5>\n<p><code><code>str = str + s<\/code><\/code>\uff1a\u5148\u628a\u7b49\u53f7\u53f3\u8fb9\u7684\u4e24\u4e2astring\u5bf9\u8c61\u76f8\u52a0\u5f97\u5230\u4e00\u4e2a\u65b0\u7684\u5bf9\u8c61\uff0c\u7136\u540e\u518d\u628a\u65b0\u5bf9\u8c61\u590d\u503c\u7ed9str<br \/>\n<code><code>str += s<\/code><\/code>\uff1a\u76f4\u63a5\u5728str\u540e\u9762\u63a5\u4e0as<\/p>\n","protected":false},"excerpt":{"rendered":"<p>gotoxy(int x,int y)\u51fd\u6570\u7684\u4f7f\u7528\u3002 \u56e0\u4e3aC++\u6807\u51c6\u5e93\u4e2d\u6ca1\u6709\u8fd9\u4e2a\u51fd\u6570\uff0c\u4f7f\u7528\u7684\u65f6\u5019\u9700\u8981\u81ea [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts\/24"}],"collection":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":7,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":1026,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts\/24\/revisions\/1026"}],"wp:attachment":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}