{"id":12,"date":"2025-11-26T00:12:18","date_gmt":"2025-11-25T16:12:18","guid":{"rendered":"http:\/\/www.gxmatmars.com\/?p=12"},"modified":"2025-11-26T14:59:04","modified_gmt":"2025-11-26T06:59:04","slug":"%e4%b8%80%e4%b8%aa%e4%bc%98%e9%9b%85%e7%9a%84%e5%ad%98%e6%a1%a3%e5%88%a0%e9%99%a4%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"http:\/\/www.gxmatmars.com\/?p=12","title":{"rendered":"\u4e00\u4e2a\u4f18\u96c5\u7684\u5b58\u6863\u5220\u9664\u65b9\u6848"},"content":{"rendered":"\n<p>\u8003\u8651\u5230\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n\n\n\n<p>\u65e0\u8bba\u662f\u6e38\u620f\u8fdb\u5ea6\u8fd8\u662f\u7cfb\u7edf\u8fd8\u539f\u70b9\uff0c\u968f\u7740\u65f6\u95f4\u589e\u957f\uff0c\u90fd\u4f1a\u4ea7\u751fN\u4e2a\u5907\u4efd\u3002\u5b9e\u9645\u751f\u4ea7\u751f\u6d3b\u4e2d\uff0c\u8ddd\u79bb\u65f6\u95f4\u6700\u8fd1\u7684\u5907\u4efd\uff0c\u5f80\u5f80\u66f4\u91cd\u8981\uff0c\u6bd4\u5982\u6bcf\u5929\u4e00\u6b21\u5907\u4efd\uff0c\u800c\u592a\u957f\u65f6\u95f4\u4ee5\u524d\u7684\u5907\u4efd\uff0c\u53ef\u80fd\u6bcf\u6708\u4e00\u6b21\u5907\u4efd\u5c31\u8db3\u591f\u4e86\u3002<\/p>\n\n\n\n<p>\u5c1d\u8bd5\u627e\u5230\u4e00\u4e2a\u7279\u5b9a\u7684\u5220\u9664\u51fd\u6570D(X)\uff0c\u8868\u793a\u7b2cX\u4e2a\u5907\u4efd\uff0c\u4f1a\u5728D(X)\u7684\u6b65\u9aa4\u88ab\u5220\u9664\uff0c\u4f7f\u5f97\u65e0\u8bba\u5728\u54ea\u4e2a\u6b65\u9aa4Y\uff0c\u79fb\u9664\u6389\u6240\u6709\u7684X<sub>i<\/sub>\u6ee1\u8db3Y&gt;=D(X<sub>i<\/sub>)\uff0c\u5269\u4e0b\u7684\u6570\u636e\uff0c\u59cb\u7ec8\u6ee1\u8db3\u201c\u8d8a\u5c0f\u7684\u6570\u636e\u95f4\u8ddd\u8d8a\u5927\u201d\u7684\u7279\u70b9\u3002<\/p>\n\n\n\n<p>\u4e3a\u6b64\uff0c\u6211\u4eec\u8003\u5bdf\u4ee5\u4e0b\u6570\u5217\uff1a<\/p>\n\n\n\n<p>[1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128]<\/p>\n\n\n\n<p>\u8fd9\u662f\u4e00\u4e2a\u95f4\u8ddd\u9010\u6e10\u589e\u5927\u7684\u6570\u5217\uff0c\u5176\u4e2d1,2,3\u95f4\u8ddd\u4e3a1\uff0c4,6,8\u95f4\u8ddd\u4e3a2\uff0c8,12,16\u95f4\u8ddd\u4e3a4\uff0c&#8230;\uff0c64,96,128\u95f4\u8ddd\u4e3a32\u3002\u53ea\u53ef\u60dc\u8fd9\u4e2a\u6570\u5217\u7684\u95f4\u8ddd\u968f\u7740\u6570\u636e\u7684\u589e\u52a0\u800c\u589e\u52a0\u3002\u7528128\u51cf\u53bb\u8fd9\u4e2a\u6570\u5217\uff0c\u5f97\u5230\uff1a<\/p>\n\n\n\n<p>[127, 126, 125, 124, 122, 120, 116, 112, 104, 96, 80, 64, 32, 0]<\/p>\n\n\n\n<p>\u770b\u5230\u7ed3\u5c3e\u662f32\uff0c\u4ece\u8fd9\u91cc\u6211\u4eec\u5f97\u5230\u4e00\u70b9\u542f\u53d1\uff0c\u662f\u5426\u53ef\u4ee5\u8ba92\u7684\u5e42\u6b21\uff08\u59822,4,8,16,32,&#8230;\uff09\u5b58\u6d3b\u65f6\u95f4\u66f4\u957f\uff0c\u66f4\u96be\u88ab\u5220\u9664\uff1f<\/p>\n\n\n\n<p>\u5230\u8fd9\u91cc\u7b97\u6cd5\u601d\u8def\u5c31\u5f88\u660e\u786e\u4e86\uff1a\u5982\u679c\u7b2cX\u7684\u5b58\u6863\u5982\u679c\u5728\u7b2cY\u6b65\u88ab\u4fdd\u7559\uff0c\u5219X\u542b2\u7684\u56e0\u5b50\u7684\u6570\u91cfp\u9700\u6ee1\u8db3p>log<sub>2<\/sub>(Y-X)\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u7ed9\u51fa\u4ee5\u4e0bPython\u4ee3\u7801\uff0c\u5b9e\u73b0\u6b64\u7b97\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:16px\"><code>def calc_delete_step(value, scale):\n    if value == 0:\n        return 0\n\n    order = 0\n    x = value\n    while x % 2 == 0:\n        x \/\/= 2\n        order += 1\n    return value + scale * (2 ** (order + 1) - 1)\n\ndef generate_remains(value, scale):\n    data = &#91;value]\n    step = 1\n\n    while value > 0:\n        for _ in range(scale):\n            value -= step\n            if value > 0:\n                data.append(value)\n        if value % (step * 2) != 0:\n            value += step\n        step *= 2\n    return data<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cccalc_delete_step\u7684\u5b9e\u73b0\u7565\u6709\u6539\u53d8\uff0c\u8fd9\u662f\u4e3a\u4e86\u4f7fgenerate_remains\u7684\u7ed3\u679c\u80fd\u4ece\u5927\u5230\u5c0f\u5206\u4e3a\u957f\u5ea6\u4e3ascale\uff0c\u95f4\u9694\u4e3a1,2,4,&#8230;\u7684\u591a\u4e2a\u7ec4\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u8003\u5bdf\u7ed3\u679c\uff0c\u9ed8\u8ba4\u53d6scale=1\uff0c\u8003\u5bdf\u4e0d\u540c\u7684N\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>N<\/td><td>Remains<\/td><\/tr><tr><td>10<\/td><td>[10, 9, 8, 4]<\/td><\/tr><tr><td>30<\/td><td>[30, 29, 28, 24, 16]<\/td><\/tr><tr><td>100<\/td><td>[100, 99, 98, 96, 88, 80, 64]<\/td><\/tr><tr><td>200<\/td><td>[200, 199, 198, 196, 192, 176, 160, 128]<\/td><\/tr><tr><td>300<\/td><td>[300, 299, 298, 296, 288, 272, 256, 192, 128]<\/td><\/tr><tr><td>500<\/td><td>[500, 499, 498, 496, 488, 480, 448, 384, 256]<\/td><\/tr><tr><td>500 (scale=3)<\/td><td>[500, 499, 498, 497, 496, 494, 492, 488, 484, 480, 472, 464, 456, 448, 432, 416, 384, 352, 320, 256, 192, 128]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u8ba1\u7b97Remains\u4eceN\u5012\u6570\u7684\u5dee\uff0c\u660e\u663e\u53d1\u73b0\u5b58\u6863\u7684\u95f4\u9694\u662f\u4ece1\u52302\u52304\u7684\u9010\u6e10\u589e\u957f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>N<\/td><td>N &#8211; r for r in Remains[::-1]<\/td><\/tr><tr><td>10<\/td><td>[0, 1, 2, 6]<\/td><\/tr><tr><td>30<\/td><td>[0, 1, 2, 6, 14]<\/td><\/tr><tr><td>100<\/td><td>[0, 1, 2, 4, 12, 20, 36]<\/td><\/tr><tr><td>200<\/td><td>[0, 1, 2, 4, 8, 24, 40, 72]<\/td><\/tr><tr><td>300<\/td><td>[0, 1, 2, 4, 12, 28, 44, 108, 172]<\/td><\/tr><tr><td>500<\/td><td>[0, 1, 2, 4, 12, 20, 52, 116, 244]<\/td><\/tr><tr><td>500 (scale=3)<\/td><td>[0, 1, 2, 3, 4, 6, 8, 12, 16, 20, 28, 36, 44, 52, 68, 84, 116, 148, 180, 244, 308, 372]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u6548\u679c\u8fd8\u662f\u5f88\u4e0d\u9519\u7684\uff0c\u5e76\u4e14\u8fd8\u67092\u70b9\u9700\u8981\u63d0\u51fa\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8fd9\u4e2a\u7b97\u6cd5\u662fo(logN)\u7684\u7b97\u6cd5\uff0c\u53ef\u4ee5\u5728\u5bf9\u6570\u65f6\u95f4\u8ba1\u7b97\u51fa\u7b2cN\u6b65\u9700\u8981\u4fdd\u7559\u7684\u5b58\u6863\u3002<\/li>\n\n\n\n<li>N\u8f83\u5927\u65f6\uff0cRemains\u7684\u6570\u91cf\u4e0eN\u8d8b\u8fd1\u4e8e\u5bf9\u6570\u5173\u7cfb\uff0c\u4e0escale\u662f\u7ebf\u6027\u5173\u7cfb\u3002<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8003\u8651\u5230\u4ee5\u4e0b\u95ee\u9898\uff1a \u65e0\u8bba\u662f\u6e38\u620f\u8fdb\u5ea6\u8fd8\u662f\u7cfb\u7edf\u8fd8\u539f\u70b9\uff0c\u968f\u7740\u65f6\u95f4\u589e\u957f\uff0c\u90fd\u4f1a\u4ea7\u751fN\u4e2a\u5907\u4efd\u3002\u5b9e\u9645\u751f\u4ea7\u751f\u6d3b\u4e2d\uff0c\u8ddd\u79bb\u65f6\u95f4\u6700\u8fd1\u7684 &hellip; <a href=\"http:\/\/www.gxmatmars.com\/?p=12\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u4e00\u4e2a\u4f18\u96c5\u7684\u5b58\u6863\u5220\u9664\u65b9\u6848\u201d<\/span><\/a><\/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":[],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12"}],"version-history":[{"count":4,"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":17,"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=\/wp\/v2\/posts\/12\/revisions\/17"}],"wp:attachment":[{"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gxmatmars.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}