{"id":1218,"date":"2010-07-23T13:11:00","date_gmt":"2010-07-23T05:11:00","guid":{"rendered":""},"modified":"2013-11-23T15:22:24","modified_gmt":"2013-11-23T07:22:24","slug":"%e6%a3%80%e6%9f%a5%e7%b4%a0%e6%95%b0%e7%9a%84%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/1218.html","title":{"rendered":"\u68c0\u67e5\u7d20\u6570\u7684\u6b63\u5219\u8868\u8fbe\u5f0f"},"content":{"rendered":"<p>\u4e00\u822c\u6765\u8bf4\uff0c\u6211\u4eec\u4f1a\u4f7f\u7528\u6b63\u89c4\u8868\u8fbe\u5f0f\u6765\u505a\u5b57\u7b26\u4e32\u5339\u914d\uff0c\u4eca\u5929\u5728\u7f51\u4e0a\u6d4f\u89c8\u7684\u65f6\u5019\uff0c\u770b\u5230\u4e86\u6709\u4eba\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u68c0\u67e5\u4e00\u4e2a\u6570\u5b57\u662f\u5426\u4e3a\u7d20\u6570\uff08\u8d28\u6570\uff09\uff0c\u8ba9\u6211\u975e\u5e38\u611f\u5174\u8da3\uff0c\u8fd9\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5982\u5165\u6240\u793a\uff1a<\/p>\n<div>\n<p><img decoding=\"async\" src=\".\/wp-content\/uploads\/hibaidu\/6d5f8b342dece35090ef39d5.jpg\" alt=\"\" border=\"0\" \/><\/p>\n<p>\u68c0\u67e5\u7d20\u6570\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\/^1?$|^(11+?)+$\/<br \/>\n\u8981\u4f7f\u7528\u8fd9\u4e2a\u6b63\u89c4\u5219\u8868\u8fbe\u5f0f\uff0c\u4f60\u9700\u8981\u628a\u81ea\u7136\u6570\u8f6c\u6210\u591a\u4e2a1\u7684\u5b57\u7b26\u4e32\uff0c\u5982\uff1a2 \u8981\u5199\u6210 \u201c11\u201d\uff0c 3 \u8981\u5199\u6210 \u201c111\u201d, 17 \u8981\u5199\u6210\u201c11111111111111111\u201d\uff0c\u8fd9\u79cd\u5de5\u4f5c\u4f7f\u7528\u4e00\u4e9b\u811a\u672c\u8bed\u8a00\u53ef\u4ee5\u8f7b\u677e\u7684\u5b8c\u6210\u3002<\/p>\n<p>\u4e00\u5f00\u59cb\u6211\u5bf9\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u6301\u6000\u7591\u6001\u5ea6\uff0c\u4f46\u4ed4\u7ec6\u7814\u7a76\u4e86\u4e00\u4e0b\u8fd9\u4e2a\u8868\u8fbe\u5f0f\uff0c\u53d1\u73b0\u662f\u975e\u5e38\u5408\u7406\u7684\uff0c\u4e0b\u9762\uff0c\u8ba9\u6211\u5e26\u4f60\u6765\u7ec6\u7ec6\u5256\u6790\u4e00\u4e0b\u662f\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u770b\u5230\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u4e2d\u6709\u201c|\u201d\uff0c\u4e5f\u5c31\u662f\u8bf4\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5206\u6210\u4e24\u4e2a\u90e8\u5206\uff1a\/^1?$\/ \u548c \/^(11+?)\\1+$\/<\/p>\n<p>\u2022\u7b2c\u4e00\u90e8\u5206\uff1a\/^1?$\/\uff0c \u8fd9\u4e2a\u90e8\u5206\u76f8\u4fe1\u4e0d\u7528\u6211\u591a\u8bf4\u4e86\uff0c\u5176\u8868\u793a\u5339\u914d\u201c\u975e\u7a7a\u4e32\u201d\u4ee5\u53ca\u5b57\u4e32\u4e2d\u4e0d\u53ea\u4e00\u4e2a\u201c1\u201d\u7684\u5b57\u7b26\u4e32\u3002<br \/>\n\u2022\u7b2c\u4e8c\u90e8\u5206\uff1a\/^(11+?)\\1+$\/\uff0c\u8fd9\u4e2a\u90e8\u5206\u662f\u6574\u4e2a\u8868\u8fbe\u5f0f\u7684\u5173\u952e\u90e8\u5206\u3002\u628a\u5426\u5b9a\u6761\u4ef6\u201c^\u201d\u53bb\u6389\uff0c\u5176\u53ef\u4ee5\u5206\u6210\u4e24\u4e2a\u90e8\u5206\uff0c(11+?) \u548c\\1+$\uff0c\u524d\u534a\u90e8\u5f88\u7b80\u5355\u4e86\uff0c\u5339\u914d\u4ee5\u201c11\u201d\u5f00\u5934\u7684\u5e76\u91cd\u590d0\u6216n\u4e2a1\u7684\u5b57\u7b26\u4e32\uff0c\u540e\u9762\u7684\u90e8\u5206\u610f\u601d\u662f\u628a\u524d\u534a\u90e8\u5206\u4f5c\u4e3a\u4e00\u4e2a\u5b57\u4e32\u53bb\u5339\u914d\u8fd8\u5269\u4e0b\u7684\u5b57\u7b26\u4e321\u6b21\u6216\u591a\u6b21\uff08\u8fd9\u53e5\u8bdd\u7684\u610f\u601d\u662f\u2014\u2014\u5269\u4f59\u7684\u5b57\u4e32\u76841\u7684\u4e2a\u6570\u8981\u662f\u524d\u9762\u5b57\u4e321\u4e2a\u6570\u7684\u6574\u6570\u500d\uff09\u3002<br \/>\n\u901a\u8fc7\u4e0a\u9762\u7684\u5206\u6790\uff0c\u6211\u4eec\u77e5\u9053\uff0c\u7b2c\u4e8c\u90e8\u5206\u662f\u6700\u91cd\u8981\u7684\uff0c\u5bf9\u4e8e\u7b2c\u4e8c\u90e8\u5206\uff0c\u4e3e\u51e0\u4e2a\u4f8b\u5b50\uff0c<\/p>\n<p>\u793a\u4f8b\u4e00\uff1a\u5224\u65ad\u81ea\u7136\u65708\u3002\u6211\u4eec\u53ef\u4ee5\u77e5\u9053\uff0c8\u8f6c\u6210\u6211\u4eec\u7684\u683c\u5f0f\u5c31\u662f\u201c11111111\u201d\uff0c\u5bf9\u4e8e(11+?)\uff0c\u5176\u5339\u914d\u4e86\u201c11\u201d\uff0c\u4e8e\u662f\u8fd8\u5269\u4e0b\u201c111111\u201d\uff0c\u800c\\1+$\u6b63\u597d\u5339\u914d\u4e86\u5269\u4e0b\u7684\u201c111111\u201d\uff0c\u56e0\u4e3a\uff0c\u201c11\u201d\u8fd9\u4e2a\u6a21\u5f0f\u5728\u201c111111\u201d\u51fa\u73b0\u4e86\u4e09\u6b21\uff0c\u7b26\u5408\u6a21\u5f0f\u5339\u914d\uff0c\u8fd4\u56detrue\u3002\u53d6\u53cd\uff08^\uff09\uff0c\u6240\u4ee5\uff0c\u5f97\u5230false\uff0c\u4e8e\u662f\u8fd9\u4e2a\u6570\u4e0d\u662f\u8d28\u6570\u3002<\/p>\n<p>\u793a\u4f8b\u4e8c\uff1a\u5224\u65ad\u81ea\u7136\u657011\u3002\u8f6c\u6210\u6211\u4eec\u9700\u8981\u7684\u683c\u5f0f\u662f\u201c11111111111\u201d\uff08\u5341\u4e00\u4e2a1\uff09\uff0c\u5bf9\u4e8e(11+?)\uff0c\u5176\u5339\u914d\u4e86\u201c11\u201d\uff08\u524d\u4e24\u4e2a1\uff09\uff0c\u8fd8\u5269\u4e0b\u201c111111111\u201d\uff08\u4e5d\u4e2a1\uff09\uff0c\u800c\\1+$\u65e0\u6cd5\u4e3a\u201c11\u201d\u5339\u914d\u90a3\u201c\u4e5d\u4e2a1\u201d\uff0c\u56e0\u4e3a\u201c11\u201d\u8fd9\u4e2a\u6a21\u5f0f\u5e76\u6ca1\u6709\u5728\u201c\u4e5d\u4e2a1\u201d\u8fd9\u4e2a\u4e32\u4e2d\u6b63\u597d\u51fa\u73b0N\u6b21\u3002\u4e8e\u662f\uff0c\u6211\u4eec\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5f15\u64ce\u4f1a\u5c1d\u8bd5\u4e0b\u4e00\u79cd\u65b9\u6cd5\uff0c\u5148\u5339\u914d\u201c111\u201d\uff08\u524d\u4e09\u4e2a1\uff09\uff0c\u7136\u540e\u628a\u201c111\u201d\u4f5c\u4e3a\u6a21\u5f0f\u53bb\u5339\u914d\u5269\u4e0b\u7684\u201c11111111\u201d\uff08\u516b\u4e2a1\uff09\uff0c\u5f88\u660e\u663e\uff0c\u90a3\u201c\u516b\u4e2a1\u201d\u5e76\u6ca1\u6709\u5339\u914d\u201c\u4e09\u4e2a1\u201d\u591a\u6b21\u3002\u6240\u4ee5\uff0c\u5f15\u64ce\u4f1a\u7ee7\u7eed\u5411\u4e0b\u5c1d\u8bd5\u2026\u2026\u76f4\u81f3\u8fd4\u56defalse\u3002<\/p>\n<p>\u901a\u8fc7\u793a\u4f8b\u4e8c\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u5230\u8fd9\u6837\u7684\u7b49\u4ef7\u6570\u7b97\u7b97\u6cd5\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u4f1a\u5339\u914d\u8fd9\u82e5\u5e72\u4e2a1\u4e2d\u6709\u6ca1\u6709\u51fa\u73b0\u201c\u4e8c\u4e2a1\u201d\u7684\u6574\u6570\u500d\uff0c\u201c\u4e09\u4e2a1\u201d\u7684\u6574\u6570\u500d\uff0c\u201c\u56db\u4e2a1\u201d\u7684\u6574\u6570\u500d\u2026\u2026\uff0c\u800c\uff0c\u8fd9\u6b63\u597d\u662f\u6211\u4eec\u9700\u8981\u7684\u7b97\u7d20\u6570\u7684\u7b97\u6cd5\u3002\u73b0\u5728\u5927\u5bb6\u660e\u767d\u4e86\u5427\u3002<\/p>\n<p>\u4e0b\u9762\uff0c\u6211\u4eec\u7528perl\u6765\u4f7f\u7528\u8fd9\u4e2a\u6b63\u89c4\u5219\u8868\u8fbe\u5f0f\u4e0d\u505c\u5730\u8f93\u51fa\u7d20\u6570\uff1a\uff08\u5173\u4e8eperl\u7684\u8bed\u6cd5\u6211\u5c31\u4e0d\u591a\u8bf4\u4e86\uff09<\/p>\n<p>perl -e&#8217;$|++;(1 x$_)!~\/^1?$|^(11+?)\\1+$\/&amp;&amp;print&#8221;$_ &#8220;while ++$_&#8217;\u53e6\u5916\uff0c\u8ba9\u6211\u4eec\u6765\u4e3e\u4e00\u53cd\u4e09\uff0c\u6839\u636e\u4e0a\u8ff0\u7684\u8fd9\u79cd\u65b9\u6cd5\uff0c\u6211\u4eec\u751a\u81f3\u53ef\u4ee5\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u6c42\u8bc1\u67d0\u65b9\u5f0f\u662f\u5426\u6709\u89e3\uff0c\u5982\uff1a<\/p>\n<p>\u2022\u4e8c\u5143\u65b9\u7a0b\uff1a17x + 12y = 51\u00a0\u00a0 \u5224\u65ad\u5176\u662f\u5426\u6709\u89e3\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\uff1a^(.*)\\1{16}(.*)\\2{11}$<br \/>\n\u2022\u4e09\u5143\u65b9\u7a0b\uff1a11x + 2y + 5z = 115 \u5224\u65ad\u5176\u662f\u5426\u6709\u89e3\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\uff1a^(.*)\\1{10}(.*)\\2{1}(.*)\\3{4}$<br \/>\n\u5927\u5bb6\u4e0d\u59a8\u81ea\u5df1\u505a\u505a\u7ec3\u4e60\uff0c\u4e3a\u4ec0\u4e48\u4e0a\u8ff0\u7684\u4e24\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5224\u65ad\u65b9\u7a0b\u662f\u5426\u6709\u89e3\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u822c\u6765\u8bf4\uff0c\u6211\u4eec\u4f1a\u4f7f\u7528\u6b63\u89c4\u8868\u8fbe\u5f0f\u6765\u505a\u5b57\u7b26\u4e32\u5339\u914d\uff0c\u4eca\u5929\u5728\u7f51\u4e0a\u6d4f\u89c8\u7684\u65f6\u5019\uff0c\u770b\u5230\u4e86\u6709\u4eba\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u68c0\u67e5\u4e00\u4e2a\u6570\u5b57\u662f\u5426\u4e3a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1218","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=1218"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1218\/revisions"}],"predecessor-version":[{"id":5163,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1218\/revisions\/5163"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}