{"id":92,"date":"2026-04-01T10:52:19","date_gmt":"2026-04-01T02:52:19","guid":{"rendered":"https:\/\/geocommunity.vip\/?p=92"},"modified":"2026-04-01T10:52:19","modified_gmt":"2026-04-01T02:52:19","slug":"%e7%a9%ba%e9%97%b4%e6%95%b0%e6%8d%ae%e7%9a%84%e5%8e%8b%e7%bc%a9","status":"publish","type":"post","link":"https:\/\/geocommunity.vip\/index.php\/2026\/04\/01\/%e7%a9%ba%e9%97%b4%e6%95%b0%e6%8d%ae%e7%9a%84%e5%8e%8b%e7%bc%a9\/","title":{"rendered":"\u7a7a\u95f4\u6570\u636e\u7684\u538b\u7f29"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u77e2\u91cf\u6570\u636e\u538b\u7f29<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1\u3001\u9694\u70b9\u62bd\u6837\u6cd5<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09\u57fa\u672c\u539f\u7406\uff1a\u6700\u7b80\u5355\u7c97\u66b4\u7684\u538b\u7f29\u65b9\u5f0f\u3002\u8bbe\u5b9a\u4e00\u4e2a\u6b65\u957f n\uff08\u4f8b\u5982 n = 2\uff09\uff0c\u4ece\u8d77\u70b9\u5f00\u59cb\uff0c\u6bcf\u9694 n-1 \u4e2a\u70b9\u4fdd\u7559\u4e00\u4e2a\u70b9\uff0c\u5176\u4f59\u70b9\u5168\u90e8\u5254\u9664\u3002\u9996\u5c3e\u4e24\u70b9\u901a\u5e38\u5f3a\u5236\u4fdd\u7559\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff082\uff09\u5b9e\u73b0\u601d\u8def\uff1a\u904d\u5386\u5750\u6807\u70b9\u6570\u7ec4\uff0c\u5229\u7528\u7d22\u5f15\u53d6\u6a21\uff08<code>index % n == 0<\/code>\uff09\u6765\u5224\u65ad\u662f\u5426\u5c06\u8be5\u70b9\u52a0\u5165\u65b0\u6570\u7ec4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff083\uff09\u4f18\u7f3a\u70b9\uff1a\u8ba1\u7b97\u6781\u5feb\uff0c\u4f46\u5728\u5730\u5f62\u590d\u6742\u3001\u66f2\u7387\u53d8\u5316\u5927\u7684\u5730\u65b9\u4f1a\u4e25\u91cd\u5931\u771f\uff0c\u5728\u5e73\u76f4\u7684\u5730\u65b9\u53c8\u4fdd\u7559\u4e86\u8fc7\u591a\u6ca1\u5fc5\u8981\u7684\u70b9\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff084\uff09\u4ee3\u7801\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1018\" height=\"1024\" src=\"https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-1018x1024.png\" alt=\"\" class=\"wp-image-93\" style=\"aspect-ratio:0.9941563725127598;width:635px;height:auto\" srcset=\"https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-1018x1024.png 1018w, https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-298x300.png 298w, https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-150x150.png 150w, https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-768x773.png 768w, https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image.png 1310w\" sizes=\"auto, (max-width: 1018px) 100vw, 1018px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>i == 0 || i = n &#8211; 1\u8868\u793a\u4e00\u5b9a\u4fdd\u6301\u5934\u5c3e\u8282\u70b9<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2\u3001\u5782\u8ddd\u6cd5<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09\u57fa\u672c\u539f\u7406\uff1a\u4e00\u79cd\u987a\u5e8f\u5316\u7b80\u6cd5\u3002\u8fde\u63a5\u66f2\u7ebf\u7684\u8d77\u70b9 A \u548c\u7ec8\u70b9 B \u4f5c\u4e3a\u57fa\u7ebf\u3002\u8ba1\u7b97\u4e2d\u95f4\u6240\u6709\u70b9\u5230\u8fd9\u6761\u57fa\u7ebf\u7684\u5782\u76f4\u8ddd\u79bb\uff08\u5782\u8ddd\uff09d\u3002\u5982\u679c d > \u9608\u503c\uff0c\u5219\u4fdd\u7559\u8be5\u70b9\u3002\u5982\u679c d &lt; \u9608\u503c \uff0c\u5219\u8be5\u70b9\u88ab\u8ba4\u4e3a\u4e0d\u91cd\u8981\uff0c\u4e88\u4ee5\u5254\u9664\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff082\uff09\u5b9e\u73b0\u601d\u8def\uff1a\u4f9d\u6b21\u904d\u5386\u4e2d\u95f4\u70b9\uff0c\u5229\u7528\u70b9\u5230\u76f4\u7ebf\u7684\u8ddd\u79bb\u516c\u5f0f\u8ba1\u7b97\u5782\u8ddd\u5e76\u4e0e\u9608\u503c\u6bd4\u8f83\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3\u3001\u9053\u683c\u62c9\u65af-\u666e\u514b\u7b97\u6cd5 (DP\u7b97\u6cd5)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09\u57fa\u672c\u539f\u7406\uff1a\u8fd9\u662f\u76ee\u524d\u6700\u7ecf\u5178\u3001\u6548\u679c\u6700\u597d\u7684\u7ebf\u5316\u7b80\u7b97\u6cd5\uff0c\u672c\u8d28\u662f\u4e00\u4e2a<strong>\u5206\u6cbb\u7b97\u6cd5 (Divide and Conquer)<\/strong>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff082\uff09\u5b9e\u73b0\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fde\u63a5\u8d77\u70b9 A \u548c\u7ec8\u70b9 B \u5f62\u6210\u4e00\u6761\u57fa\u7ebf\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8ba1\u7b97\u66f2\u7ebf\u4e0a\u6240\u6709\u4e2d\u95f4\u70b9\u5230\u8fd9\u6761\u57fa\u7ebf\u7684\u5782\u8ddd\uff0c\u627e\u5230\u8ddd\u79bb\u6700\u5927\u4e14\u5927\u4e8e\u7ed9\u5b9a\u9608\u503c \u7684\u70b9 C\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u6700\u5927\u7684\u5782\u8ddd\u4e5f\u5c0f\u4e8e\u9608\u503c\uff0c\u5219\u4e2d\u95f4\u6240\u6709\u70b9\u90fd\u820d\u5f03\uff0c\u5316\u7b80\u7ed3\u675f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u627e\u5230\u4e86\u70b9 C\uff08\u4fdd\u7559\u70b9 C\uff09\uff0c\u5219\u4ee5 C \u4e3a\u754c\uff0c\u5c06\u66f2\u7ebf\u5206\u4e3a AC \u548c CB \u4e24\u6bb5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9 AC \u548c CB \u4e24\u6bb5<strong>\u9012\u5f52<\/strong>\u91cd\u590d\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u76f4\u5230\u6ca1\u6709\u70b9\u6ee1\u8db3\u6761\u4ef6\u4e3a\u6b62\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff083\uff09\u5b9e\u73b0\u601d\u8def\uff1a\u975e\u5e38\u9002\u5408\u7528\u9012\u5f52\u51fd\u6570\u6765\u5b9e\u73b0\u3002\u8f93\u5165\u70b9\u96c6\u3001\u8d77\u59cb\u7d22\u5f15\u3001\u7ed3\u675f\u7d22\u5f15\u548c\u5bb9\u5dee\u9608\u503c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff084\uff09\u4ee3\u7801\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"831\" src=\"https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-1.png\" alt=\"\" class=\"wp-image-94\" style=\"aspect-ratio:0.7870039732434744;width:616px;height:auto\" srcset=\"https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-1.png 654w, https:\/\/geocommunity.vip\/wp-content\/uploads\/2026\/04\/image-1-236x300.png 236w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">4\u3001\u5149\u680f\u6cd5 (Corridor Method)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. \u521d\u59cb\u5149\u675f\uff08\u6253\u5f00\u624b\u7535\u7b52\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f60\u7ad9\u5728\u8d77\u70b9 P_1\uff0c\u770b\u5411\u4e0b\u4e00\u4e2a\u70b9 P_2\u3002<\/li>\n\n\n\n<li>\u4f60\u4ece\u8d77\u70b9 P_1 \u5411 P_2 \u5468\u56f4\u7684\u90a3\u4e2a\u201c\u5bb9\u5dee\u5706\u201d\u53d1\u5c04\u4e24\u6839\u76f8\u5207\u7684\u5c04\u7ebf\u3002\u8fd9\u4e24\u6839\u5c04\u7ebf\u4e4b\u95f4\u5f62\u6210\u4e86\u4e00\u4e2a\u6247\u5f62\u7684\u533a\u57df\uff0c\u8fd9\u5c31\u662f\u4f60\u7684\u201c\u521d\u59cb\u5149\u680f\u201d\u6216\u8005\u8bf4\u521d\u59cb\u7684\u63a2\u7167\u706f\u5149\u675f\uff09\u3002<\/li>\n\n\n\n<li>\u53ea\u8981\u540e\u9762\u7684\u70b9\u80fd\u843d\u5728\u8fd9\u4e2a\u5149\u675f\u91cc\uff0c\u8bf4\u660e\u6298\u7ebf\u8fd8\u7b97\u5e73\u76f4\uff0c\u6ca1\u6709\u53d1\u751f\u592a\u5927\u7684\u5f2f\u6298\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">2. \u5149\u675f\u6536\u7f29\uff08\u4e0d\u65ad\u53d6\u4ea4\u96c6\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u63a5\u7740\u4f60\u7ad9\u5728\u539f\u5730\u770b\u5411\u7b2c\u4e09\u4e2a\u70b9 P_3\u3002\u540c\u6837\u5730\uff0c\u4ece P_1 \u5411 P_3 \u7684\u201c\u5bb9\u5dee\u5706\u201d\u53d1\u5c04\u5207\u7ebf\uff0c\u5f62\u6210\u4e00\u4e2a\u65b0\u7684\u6247\u5f62\u3002<\/li>\n\n\n\n<li><strong>\u6838\u5fc3\u52a8\u4f5c\u6765\u4e86<\/strong>\uff1a\u4f60\u5fc5\u987b\u628a\u65e7\u7684\u201c\u5149\u680f\u201d\u548c\u65b0\u7684\u6247\u5f62<strong>\u53d6\u4ea4\u96c6\uff08\u91cd\u53e0\u90e8\u5206\uff09<\/strong>\uff0c\u4f5c\u4e3a\u65b0\u7684\u201c\u6709\u6548\u5149\u680f\u201d\u3002<\/li>\n\n\n\n<li>\u56e0\u4e3a\u8981\u540c\u65f6\u6ee1\u8db3\u7a7f\u8fc7 P_2 \u7684\u5bb9\u5dee\u5706\u548c P_3 \u7684\u5bb9\u5dee\u5706\uff0c\u4f60\u7684\u624b\u7535\u7b52\u5149\u675f\u5c31\u4f1a<strong>\u88ab\u8feb\u53d8\u5f97\u8d8a\u6765\u8d8a\u7a84<\/strong>\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">3. \u89e6\u53d1\u65ad\u70b9\uff08\u5149\u7167\u4e0d\u5230\u7684\u5730\u65b9\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f60\u7ee7\u7eed\u5f80\u4e0b\u626b\u63cf P_4\u3001P_5\u2026\u2026 \u6bcf\u6b21\u90fd\u7528 P_1 \u5230\u65b0\u70b9\u7684\u6247\u5f62\u53bb\u548c\u5f53\u524d\u7684\u5149\u680f\u53d6\u4ea4\u96c6\u3002\u5149\u680f\u8d8a\u6765\u8d8a\u7a84\u3002<\/li>\n\n\n\n<li>\u76f4\u5230\u626b\u63cf\u5230\u67d0\u4e00\u4e2a\u70b9 P_n \u65f6\uff0c\u4f60\u53d1\u73b0\uff1a\u4ece P_1 \u5230 P_n \u5bb9\u5dee\u5706\u5f62\u6210\u7684\u6247\u5f62\uff0c\u8ddf\u5f53\u524d\u7684\u201c\u6709\u6548\u5149\u680f\u201d<strong>\u5b8c\u5168\u6ca1\u6709\u91cd\u53e0\u4e86<\/strong>\uff08\u4ea4\u96c6\u4e3a\u7a7a\uff09\uff01<\/li>\n\n\n\n<li>\u8fd9\u610f\u5473\u7740\u6298\u7ebf\u5728\u8fd9\u4e2a\u5730\u65b9\u53d1\u751f\u4e86\u6781\u5176\u5267\u70c8\u7684\u62d0\u5f2f\uff0c\u4e4b\u524d\u7684\u5149\u675f\u5df2\u7ecf\u201c\u7167\u4e0d\u5230\u201d\u5b83\u4e86\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">4. \u4fdd\u7559\u5e76\u91cd\u542f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u65e2\u7136 P_n \u504f\u79bb\u592a\u8fdc\uff0c\u6211\u4eec\u5c31\u628a\u5bfc\u81f4\u5149\u675f\u5931\u6548\u7684\u524d\u4e00\u4e2a\u70b9\u2014\u2014<strong>\u5373 P_{n-1}\u2014\u2014\u5f3a\u5236\u4fdd\u7559\u4e0b\u6765<\/strong>\u3002<\/li>\n\n\n\n<li>\u7136\u540e\uff0c\u4f60\u628a\u8d77\u70b9\u79fb\u52a8\u5230 P_{n-1}\uff0c\u628a\u5b83\u5f53\u6210\u65b0\u7684 P_1\uff0c\u91cd\u65b0\u6253\u5f00\u624b\u7535\u7b52\uff0c\u5bf9\u7740\u4e0b\u4e00\u4e2a\u70b9\u7ee7\u7eed\u91cd\u590d\u4e0a\u9762\u7684\u8fc7\u7a0b\uff0c\u76f4\u5230\u6574\u6761\u7ebf\u626b\u63cf\u5b8c\u6bd5\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5\u3001Li &amp; Openshaw \u7b97\u6cd5<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u786e\u5b9a\u7f51\u683c\u5927\u5c0f\uff08\u5173\u952e\u70b9\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7f51\u683c\u7684\u5927\u5c0f\uff08\u6bcf\u4e2a\u5c0f\u683c\u5b50\u7684\u8fb9\u957f g\uff09\u4e0d\u662f\u968f\u4fbf\u5b9a\u7684\uff0c\u5b83\u662f\u6839\u636e<strong>\u76ee\u6807\u6bd4\u4f8b\u5c3a<\/strong>\u8ba1\u7b97\u51fa\u6765\u7684\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u6bd4\u5982\uff1a\u5982\u679c\u4f60\u8981\u628a 1:1 \u4e07\u7684\u5730\u56fe\u7f29\u51cf\u5230 1:5 \u4e07\uff0c\u7f51\u683c\u5c31\u4f1a\u53d8\u5927\u3002\u8fd9\u4e2a\u7f51\u683c\u4ee3\u8868\u4e86\u4eba\u7c7b\u773c\u775b\u5728\u90a3\u4e2a\u6bd4\u4f8b\u5c3a\u4e0b\u80fd\u770b\u6e05\u7684\u201c\u6700\u5c0f\u7ec6\u8282\u201d\u3002<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u53e0\u52a0\uff08\u6805\u683c\u5316\u89c6\u89d2\u7684\u4ecb\u5165\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u628a\u4f60\u7684\u77e2\u91cf\u7ebf\u201c\u8eba\u201d\u5728\u8fd9\u4e2a\u7f51\u683c\u9635\u5217\u91cc\u3002\u6b64\u65f6\uff0c\u8fd9\u6761\u7ebf\u4f1a\u7a7f\u8fc7\u5f88\u591a\u4e2a\u5c0f\u683c\u5b50\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u7b5b\u9009\uff08\u6bcf\u4e2a\u683c\u5b50\u53ea\u7559\u4e00\u4e2a\u4ee3\u8868\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f\u8be5\u7b97\u6cd5\u6700\u6838\u5fc3\u7684\u201c\u81ea\u7136\u6cd5\u5219\u201d\uff1a<strong>\u5728\u4e00\u4e2a\u7f51\u683c\u7684\u8303\u56f4\u5185\uff0c\u4eba\u7684\u89c6\u89c9\u65e0\u6cd5\u5206\u8fa8\u592a\u7ec6\u5fae\u7684\u6296\u52a8\u3002<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b97\u6cd5\u4f1a\u68c0\u67e5\u6bcf\u4e00\u4e2a\u88ab\u7ebf\u6761\u7a7f\u8fc7\u7684\u683c\u5b50\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u4e00\u6761\u7ebf\u5728\u4e00\u4e2a\u683c\u5b50\u91cc\u7ed5\u4e86\u597d\u51e0\u4e2a\u5f2f\uff08\u6709\u597d\u51e0\u4e2a\u5750\u6807\u70b9\uff09\uff0c\u7b97\u6cd5\u53ea\u4f1a\u5728\u8fd9\u4e2a\u683c\u5b50\u91cc<strong>\u4fdd\u7559\u4e00\u4e2a\u70b9<\/strong>\u3002<\/li>\n\n\n\n<li><strong>\u9009\u54ea\u4e2a\u70b9\uff1f<\/strong> \u901a\u5e38\u6709\u51e0\u79cd\u7b56\u7565\uff1a\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u6700\u9760\u8fd1\u683c\u5b50\u4e2d\u5fc3\u7684\u539f\u6709\u5750\u6807\u70b9\u3002<\/li>\n\n\n\n<li>\u7ebf\u6761\u8fdb\u5165\u683c\u5b50\u7684\u8fdb\u5165\u70b9\u548c\u79bb\u5f00\u70b9\u7684\u4e2d\u70b9\u3002<\/li>\n\n\n\n<li>\u683c\u5b50\u5185\u6240\u6709\u70b9\u7684\u5e73\u5747\u4f4d\u7f6e\u3002<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u91cd\u8fde<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u6bcf\u4e2a\u683c\u5b50\u9009\u51fa\u7684\u201c\u4ee3\u8868\u70b9\u201d\u6309\u539f\u987a\u5e8f\u8fde\u63a5\u8d77\u6765\uff0c\u5c31\u5f97\u5230\u4e86\u4e00\u6761\u5e73\u6ed1\u4e14\u6570\u636e\u91cf\u6781\u5927\u7684\u7b80\u5316\u7684\u77e2\u91cf\u7ebf\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001<strong>\u5982\u679c\u4e24\u4e2a\u70b9\u79bb\u5f97\u592a\u8fd1\uff0c\u8fd1\u5230\u5728\u76ee\u6807\u6bd4\u4f8b\u5c3a\u4e0b\u8fde\u6210\u4e86\u4e00\u4e2a\u50cf\u7d20\u70b9\uff0c\u90a3\u4fdd\u7559\u4e24\u4e2a\u70b9\u5c31\u6ca1\u6709\u610f\u4e49\u3002<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u6805\u683c\u6570\u636e\u538b\u7f29<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1\u3001\u6e38\u7a0b\u7f16\u7801 (Run-length Encoding, RLE)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09<strong>\u57fa\u672c\u539f\u7406<\/strong>\uff1a\u9010\u884c\u626b\u63cf\u6805\u683c\uff0c\u5c06\u76f8\u90bb\u4e14\u5c5e\u6027\u503c\u76f8\u540c\u7684\u50cf\u5143\u5408\u5e76\uff0c\u8bb0\u5f55\u201c\u5c5e\u6027\u503c\u201d\u548c\u201c\u8fde\u7eed\u51fa\u73b0\u7684\u6b21\u6570\uff08\u6e38\u7a0b\u957f\u5ea6\uff09\u201d\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>\u793a\u4f8b<\/em>\uff1a\u67d0\u4e00\u884c\u50cf\u5143\u503c\u4e3a <code>A A A A B B C C C<\/code>\uff0c\u6e38\u7a0b\u7f16\u7801\u540e\u53d8\u4e3a <code>(A, 4), (B, 2), (C, 3)<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\uff082\uff09<strong>\u5b9e\u73b0\u601d\u8def<\/strong>\uff1a\u4f7f\u7528\u53cc\u6307\u9488\u6216\u8ba1\u6570\u5668\u904d\u5386\u4e8c\u7ef4\u6570\u7ec4\u7684\u6bcf\u4e00\u884c\uff0c\u5f53\u5f53\u524d\u503c\u4e0e\u524d\u4e00\u4e2a\u503c\u4e0d\u540c\u65f6\uff0c\u8bb0\u5f55\u524d\u4e00\u4e2a\u503c\u7684\u603b\u6570\u5e76\u91cd\u7f6e\u8ba1\u6570\u5668\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff083\uff09\u4ee3\u7801\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* \u6e38\u7a0b\u7f16\u7801 *\/\nRun* rle_encode(char* data, int n, int* out_len) {\n    Run* runs = (Run*)malloc(n * sizeof(Run));\n    int j = 0;\n    int i = 0;\n<strong>    while (i &lt; n) {\n        int cnt = 1;\n        while (i + cnt &lt; n &amp;&amp; data&#91;i + cnt] == data&#91;i]) {\n            cnt++;\n        }\n        runs&#91;j].value = data&#91;i];\n        runs&#91;j].count = cnt;\n        j++;\n        i += cnt;\n    }<\/strong>\n\n    *out_len = j;\n    return runs;\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* \u5bf9\u4e8c\u7ef4\u5b57\u7b26\u4e32\u6309\u884c\u8fdb\u884c\u6e38\u7a0b\u7f16\u7801 *\/\nvoid rle_encode_2d(char* data&#91;], int rows, int cols) {\n    for (int r = 0; r &lt; rows; r++) {\n        int run_len = 0;\n        Run* runs = rle_encode(data&#91;r], cols, &amp;run_len);\n\n        for (int i = 0; <strong>i &lt; run_len;<\/strong> i++) {\n            <strong>printf(\"(%c, %d) \", runs&#91;i].value, runs&#91;i].count);<\/strong>\n        }\n        free(runs);\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2\u3001\u5757\u72b6\u7f16\u7801<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u57fa\u672c\u539f\u7406<\/strong>\uff1a\u6e38\u7a0b\u7f16\u7801\u662f\u4e8c\u7ef4\u6570\u636e\u7684\u4e00\u7ef4\u5316\u538b\u7f29\uff0c\u800c\u5757\u7801\u662f\u771f\u6b63\u7684\u4e8c\u7ef4\u538b\u7f29\u3002\u5b83\u5c06\u5177\u6709\u76f8\u540c\u5c5e\u6027\u7684\u76f8\u90bb\u591a\u8fb9\u5f62\u533a\u57df\u5212\u5206\u6210\u6b63\u65b9\u5f62\u7684\u201c\u5757\u201d\u3002\u6570\u636e\u7ed3\u6784\u4e2d\u8bb0\u5f55\u6b63\u65b9\u5f62\u7684<strong>\u4e2d\u5fc3\u70b9\uff08\u6216\u5de6\u4e0b\u89d2\uff09\u5750\u6807<\/strong>\u3001<strong>\u6b63\u65b9\u5f62\u7684\u8fb9\u957f\uff08\u6216\u534a\u5f84\uff09<strong>\u4ee5\u53ca<\/strong>\u5c5e\u6027\u503c<\/strong>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3\u3001\u56db\u53c9\u6811\u7f16\u7801<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u57fa\u672c\u539f\u7406<\/strong>\uff1a\u4e00\u79cd\u9012\u5f52\u5212\u5206\u7a7a\u95f4\u7684\u6811\u72b6\u7ed3\u6784\u3002\u5c06\u6574\u4e2a\u6805\u683c\u533a\u57df\u5747\u5206\u4e3a\u56db\u4e2a\u8c61\u9650\uff08\u5b50\u533a\u57df\uff09\u3002\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u67d0\u4e2a\u5b50\u533a\u57df\u5185\u6240\u6709\u50cf\u5143\u7684\u5c5e\u6027\u503c\u5b8c\u5168\u4e00\u81f4\uff0c\u8be5\u533a\u57df\u5c31\u4e0d\u518d\u5212\u5206\uff0c\u6210\u4e3a\u6811\u7684\u53f6\u5b50\u8282\u70b9\uff0c\u5e76\u8bb0\u5f55\u8be5\u5c5e\u6027\u503c\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u5b50\u533a\u57df\u5185\u5305\u542b\u4e0d\u540c\u7684\u5c5e\u6027\u503c\uff0c\u5219\u5c06\u5176\u7ee7\u7eed\u7b49\u5206\u4e3a\u56db\u4e2a\u66f4\u5c0f\u7684\u5b50\u533a\u57df\uff0c\u76f4\u5230\u5212\u5206\u51fa\u7684\u533a\u57df\u5c5e\u6027\u5355\u4e00\uff0c\u6216\u8005\u8fbe\u5230\u4e86\u50cf\u5143\u7684\u6700\u5c0f\u5206\u8fa8\u7387\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u8fd9\u5728\u7a7a\u95f4\u6570\u636e\u5e93\u7d22\u5f15\u548c\u6d77\u91cf\u56fe\u50cf\u538b\u7f29\u4e2d\u6781\u5176\u5e38\u7528\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4\u3001\u94fe\u7801 (Chain Code)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u57fa\u672c\u539f\u7406<\/strong>\uff1a\u4e3b\u8981\u7528\u4e8e\u8bb0\u5f55\u9762\u72b6\u8981\u7d20\u7684\u8fb9\u754c\u3002\u5b83\u4e0d\u8bb0\u5f55\u5185\u90e8\u6240\u6709\u50cf\u5143\uff0c\u800c\u662f\u4ece\u8fb9\u754c\u4e0a\u7684\u67d0\u4e00\u8d77\u70b9\u5f00\u59cb\uff0c\u6309\u7167\u7279\u5b9a\u7684\u65b9\u5411\uff08\u901a\u5e38\u4f7f\u7528 0 &#8211; 7 \u4ee3\u8868\u516b\u4e2a\u65b9\u5411\uff09\u4e00\u6b65\u6b65\u8ffd\u8e2a\u8fb9\u754c\uff0c\u8bb0\u5f55\u4e0b\u79fb\u52a8\u7684\u65b9\u5411\u5e8f\u5217\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>\u793a\u4f8b<\/em>\uff1a\u6cbf\u7740\u8fb9\u754c\u8d70\uff0c\u53ef\u80fd\u8bb0\u5f55\u4e3a <code>\u8d77\u70b9\u5750\u6807 + \u65b9\u5411\u5e8f\u5217(0, 1, 1, 2, 4...)<\/code>\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u77e2\u91cf\u6570\u636e\u538b\u7f29 1\u3001\u9694\u70b9\u62bd\u6837\u6cd5 \uff081\uff09\u57fa\u672c\u539f\u7406\uff1a &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-gis"],"_links":{"self":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":1,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts\/92\/revisions"}],"predecessor-version":[{"id":95,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts\/92\/revisions\/95"}],"wp:attachment":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/categories?post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/tags?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}