{"id":7443,"date":"2024-03-30T12:01:01","date_gmt":"2024-03-30T04:01:01","guid":{"rendered":""},"modified":"2024-03-30T12:01:01","modified_gmt":"2024-03-30T04:01:01","slug":"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1","status":"publish","type":"post","link":"https:\/\/mushiming.com\/7443.html","title":{"rendered":"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\n

\u672c\u6587\u4e3b\u8981\u5206\u4eab\u7b97\u6cd5\u8bbe\u8ba1\u601d\u8def\uff0c\u5176\u4e2d\u4ee3\u7801\u5747\u539f\u521b\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\u548c\u5b66\u4e60<\/p>\n<\/blockquote>\n

\n

\u6587\u7ae0\u76ee\u5f55<\/h4>\n
    \n
  • \u524d\u8a00<\/li>\n
  • \u4e00\u3001\u95ee\u9898\u63cf\u8ff0<\/li>\n
  • \n
      \n
    • 1.\u6982\u8ff0<\/li>\n
    • 2.\u5177\u4f53\u8981\u6c42<\/li>\n<\/ul>\n<\/li>\n
    • \u4e8c\u3001\u6570\u636e\u5b58\u50a8\u65b9\u6848<\/li>\n
    • \n
        \n
      • 1.\u540d\u5b57\u5bf9\u5e94\u7684\u97f3\u8282\u7ec4\u5408<\/li>\n
      • 2.\u62fc\u97f3\u5e93<\/li>\n
      • 3.\u901a\u8baf\u5f55\u8868<\/li>\n<\/ul>\n<\/li>\n
      • \u4e09\u3001\u62fc\u97f3\u6a21\u7cca\u5339\u914d\u7684\u9012\u5f52\u56de\u6eaf\u7b97\u6cd5<\/li>\n
      • \n
          \n
        • 1.\u62fc\u97f3\u5339\u914d\u5904\u7406\u51fd\u6570<\/li>\n
        • 2.\u62fc\u97f3\u6a21\u7cca\u5339\u914d\u6838\u5fc3\u9012\u5f52\u56de\u6eaf\uff08Match\uff09<\/li>\n<\/ul>\n<\/li>\n
        • \u56db\u3001\u6211\u6700\u7ec8\u5b9e\u73b0\u7684\u6548\u679c<\/li>\n
        • \n
            \n
          • 1.\u7ed3\u679c\u63cf\u8ff0<\/li>\n
          • 2.\u6d4b\u8bd5<\/li>\n
          • 3.\u6211\u7684\u5c0f\u5c0f\u7684\u6539\u8fdb\u5efa\u8bae<\/li>\n<\/ul>\n<\/li>\n
          • \u603b\u7ed3<\/li>\n<\/ul>\n<\/div>\n
            \n

            \u524d\u8a00<\/h2>\n

            \u5f00\u59cb\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u7684\u65f6\u5019\uff0c\u5f88\u591a\u50cf\u987a\u5e8f\u8868\u3001\u4e8c\u53c9\u6811\u3001\u90bb\u63a5\u94fe\u8868\u7684\u7ed3\u6784\u5b66\u4f1a\u4e86\u5b8c\u5168\u4e0d\u77e5\u9053\u8be5\u5728\u4ec0\u4e48\u5730\u65b9\u4f7f\u7528\u3002\u5230\u5b66\u4e60\u7b97\u6cd5\u4e00\u6bb5\u65f6\u95f4\uff0c\u505a\u4e86\u4e9b\u9898\u76ee\u540e\uff0c\u53d1\u73b0\u81ea\u5df1\u8fd8\u662f\u9700\u8981\u9605\u8bfb\u4e00\u4e9b\u535a\u5ba2\u548c\u4ee5\u524d\u5199\u8fc7\u7684\u6570\u636e\u7ed3\u6784\u53bb\u201c\u542f\u53d1\u5f0f\u201d\u7684\u5f15\u5bfc\u81ea\u5df1\u89e3\u51b3\u95ee\u9898\u3002\u5176\u5b9e\u6211\u4eec\u4e00\u5f00\u59cb\u5728\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u7684\u65f6\u5019\u5c31\u5e94\u8be5\u53bb\u601d\u8003\u6bcf\u4e2a\u6570\u636e\u7ed3\u6784\u53ef\u4ee5\u5e94\u7528\u7684\u573a\u666f\uff0c\u8fd9\u6837\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u624d\u6709\u610f\u601d\uff0c\u624d\u80fd\u201c\u73a9\u8f6c\u6570\u636e\u7ed3\u6784\u201d\u3002<\/p>\n

            \u901a\u8baf\u5f55\u7684\u62fc\u97f3\u641c\u7d22\u4e5f\u662f\u6211\u4eec\u5e38\u7528\u7684\u573a\u666f\uff0c\u201c\u5e38\u7528\u201d\u3001\u201c\u4e0d\u8d77\u773c\u201d\u3001\u4f46\u201c\u6709\u610f\u601d\u201d\u3002\u672c\u9879\u76ee\u4e5f\u662f\u6211\u5728\u5927\u4e8c\u6570\u636e\u7ed3\u6784\u8bfe\u7a0b\u8bbe\u8ba1\u7684\u9009\u9898\uff0c\u5206\u4eab\u4e00\u4e0b\u6211\u7684\u601d\u60f3\u7ed9\u5927\u5bb6\u3002<\/p>\n


            \n

            \u63d0\u793a\uff1a\u95ee\u9898\u63cf\u8ff0\u5f88\u91cd\u8981\uff0c\u5927\u5bb6\u4ee5\u540e\u505a\u7b97\u6cd5\u6216\u8005\u5f00\u53d1\u4e5f\u4e00\u5b9a\u8981\u5173\u6ce8\u95ee\u9898\u63cf\u8ff0\uff01\uff01\uff01<\/code><\/p>\n

            \u4e00\u3001\u95ee\u9898\u63cf\u8ff0<\/h2>\n

            1.\u6982\u8ff0<\/h3>\n

            \u6211\u4eec\u4f5c\u4e3a\u4e2a\u4eba\u6bcf\u5929\u90fd\u4f7f\u7528\u901a\u8baf\u5f55\uff08\u5305\u62ec\u5fae\u4fe1\u3001qq\u4e2d\u7684\u901a\u8baf\u5f55\uff09\uff0c\u4f46\u8003\u8651\u4e00\u4e2a\u6bd4\u8f83\u5927\u7684\u573a\u666f\uff0c\u8bb8\u591a\u5927\u578b\u4f01\u4e1a\u4e5f\u62e5\u6709\u4f01\u4e1a\u7684\u901a\u8baf\u5f55\uff0c\u53ef\u80fd\u6709\u4e0a\u5343\u751a\u81f3\u4e0a\u4e07\u4eba\u7684\u540d\u5f55\uff0c\u90a3\u4e48\u6211\u4eec\u5c31\u5e0c\u671b\u505a\u8bbe\u8ba1\u4e00\u4e2a\u5feb\u901f\u68c0\u7d22\u7b97\u6cd5\uff0c\u80fd\u591f\u901a\u8fc7\u8f93\u5165\u90e8\u5206\u7684\u5173\u952e\u5b57\u7684\u9996\u62fc\u5b57\u6bcd\u5feb\u901f\u7684\u8fc7\u6ee4\u51fa\u4f60\u60f3\u8981\u7684\u8054\u7cfb\u4eba\u3002<\/p>\n

            2.\u5177\u4f53\u8981\u6c42<\/h3>\n
              \n
            1. \u6bcf\u4e2a\u4eba\u7684\u59d3\u540d\u53ef\u4ee5\u4ece\u7b2c\u4e00\u4e2a\u5b57\u5f00\u59cb\u5339\u914d\uff0c\u4e5f\u53ef\u4ee5\u4ece\u540e\u9762\u7684\u5b57\u5f00\u59cb\u5339\u914d\uff0c\u5982\u201c\u5173\u4e91\u957f\u201d\u53ef\u4ee5\u8003\u8651\u201cguanyun\u201d\uff0c\u201cguanyinchang\u201d\uff0c\u201cyunchang\u201d\uff0c\u4f46\u4e0d\u80fd\u8003\u8651\u65ad\u5f00\u7684\u60c5\u51b5\uff0c\u5982\u201cguanchang\u201d\u3002<\/li>\n
            2. \u201c\u591a\u97f3\u5b57\u201d\u5339\u914d\u7684\u6240\u6709\u53ef\u80fd\uff0c\u5982\u201cchang\u201d\u53ef\u4ee5\u8003\u8651\u201czhang\u201d\u548c\u201cchang\u201d\u3002\uff08\u8fd9\u91cc\u89e3\u91ca\u4e00\u4e0b\uff0c\u4e3a\u4ec0\u4e48\u201cchang\u201d\u4e0d\u5355\u72ec\u53ea\u5339\u914d\u201cchang\u201d\uff0c\u56e0\u4e3a\u5f88\u591a\u65f6\u5019\u6211\u4eec\u5b58\u4e86\u542b\u591a\u97f3\uff0c\u8981\u4fdd\u8bc1\u5047\u8bbe\u7528\u6237\u4e0d\u4f1a\u201c\u8bfb\u201d\u7684\u60c5\u51b5\u4e0b\uff0c\u4ecd\u7136\u53ef\u4ee5\u641c\u7d22\u5230\u3002\uff09<\/li>\n
            3. \u6bcf\u4e2a\u6c49\u5b57\u7684\u97f3\u8282\u53ef\u4ee5\u53ea\u5339\u914d\u90e8\u5206\u524d\u7f00\uff0c\u5982\u201c\u5173\u4e91\u957f\u201d\u53ef\u4ee5\u7528\u201cgyc\u201d \uff0c\u201cguyuchang\u201d\uff0c\u201cyunchang\u201d\uff0c\u201cyuc\u201d\u5f97\u5230\u5339\u914d\u3002<\/li>\n
            4. \u5b9e\u73b0\u6392\u5e8f\u663e\u793a<\/li>\n
            5. \u76f8\u5173\u6570\u636e\u7ed3\u6784\u3001\u7b97\u6cd5\uff1a\u54c8\u5e0c\u8868\uff0c\u987a\u5e8f\u8868\uff0c\u9012\u5f52\u56de\u6eaf<\/li>\n<\/ol>\n

              \u4e8c\u3001\u6570\u636e\u5b58\u50a8\u65b9\u6848<\/h2>\n

              1.\u540d\u5b57\u5bf9\u5e94\u7684\u97f3\u8282\u7ec4\u5408<\/h3>\n

              \u5b58\u50a8\u540d\u5b57\u7684\u6bcf\u4e2a\u5b57\u5bf9\u5e94\u7684\u97f3\u8282\u91c7\u7528\u201c\u5b57\u7b26\u4e32\u201d\u7c7b\u578b\u7684\u987a\u5e8f\u8868\u201cStringList\u201d\u5b58\u50a8\u5143\u7d20\u3002\u4e00\u4e2a\u987a\u5e8f\u8868\u7ed3\u6784\u5b58\u5904\u4e00\u4e2a\u540d\u5b57\u7684\u8bfb\u97f3\u7ec4\u5408\uff0c\u6bd4\u5982\u201cguanyunchang\u201d\u53ef\u4ee5\u5b58\u50a8\u4e3a\u4e00\u4e2a\u987a\u5e8f\u8868\u7ed3\u6784\uff0c\u201cguan\u201d\u5b58\u5165item[0]\uff0c\u201cyun\u201d\u5b58\u5165item[1]\uff0c\u201cchang\u201d\u5b58\u5165item[2]\u3002\u53ef\u4ee5\u901a\u8fc7item[0][0]\u8bbf\u95ee\u5230\u2018g\u2019\u3002<\/p>\n

              \u5176\u5b9e\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u91c7\u7528\u5b57\u7b26\u4e32\u7c7b\u578b\u6570\u7ec4\uff0c\u4f46\u662f\u6bd5\u7adf\u5b66\u4e60\u4e86\u6570\u636e\u7ed3\u6784\uff0c\u60f3\u7ec3\u4e60\u4e00\u4e0b\u987a\u5e8f\u8868\u7684\u4f7f\u7528\uff0c\u5e76\u4e14\u81ea\u5df1\u5199\u7684\u987a\u5e8f\u8868\u5728\u4f7f\u7528\u4e0a\u66f4\u52a0\u7075\u6d3b\u3002<\/p>\n

              \/\/\u987a\u5e8f\u8868<\/span>\nstruct<\/span> StringList<\/span> { \n   <\/span>\n\tstring*<\/span> item;<\/span>\n\tint<\/span> capacity;<\/span>\n\tint<\/span> length;<\/span>\n\t\n\t\/\/\u6784\u9020\u51fd\u6570<\/span>\n\tStringList<\/span>(<\/span>int<\/span> c=<\/span>10<\/span>)<\/span> { \n   <\/span>\n\t\tcapacity =<\/span> c;<\/span>\n\t\tlength =<\/span> 0<\/span>;<\/span>\n\t\titem =<\/span> new<\/span> string[<\/span>capacity]<\/span>;<\/span>\n\t}<\/span>\n\n\t\/\/\u6dfb\u52a0\u5143\u7d20<\/span>\n\tvoid<\/span> append<\/span>(<\/span>string s)<\/span> { \n   <\/span>\n\t\tif<\/span> (<\/span>length ==<\/span> capacity)<\/span> { \n   <\/span>\n\t\t\tcapacity +=<\/span> 10<\/span>;<\/span>\n\t\t\titem =<\/span> new<\/span> string[<\/span>capacity]<\/span>;<\/span>\n\t\t}<\/span>\n\t\titem[<\/span>length++<\/span>]<\/span> =<\/span> s;<\/span>\n\t}<\/span>\n\n\t\/\/\u8fd4\u56de\u6307\u5b9a\u4f4d\u7f6eindex\u7684\u5143\u7d20<\/span>\n\tstring getItem<\/span>(<\/span>int<\/span> index)<\/span> { \n   <\/span>\n\t\treturn<\/span> item[<\/span>index]<\/span>;<\/span>\n\t}<\/span>\n\n\t\/\/\u663e\u793a\u5168\u90e8\u5143\u7d20<\/span>\n\tvoid<\/span> show<\/span>(<\/span>)<\/span> { \n   <\/span>\n\t\tfor<\/span> (<\/span>int<\/span> i =<\/span> 0<\/span>;<\/span> i <<\/span> length;<\/span> i++<\/span>)<\/span> { \n   <\/span>\n\t\t\tcout <<<\/span> item[<\/span>i]<\/span> <<<\/span> \" \"<\/span>;<\/span>\n\t\t}<\/span>\n\t\tcout <<<\/span> endl;<\/span>\n\t}<\/span>\n\n}<\/span>;<\/span>\n<\/code><\/pre>\n

              2.\u62fc\u97f3\u5e93<\/h3>\n

              \u62fc\u97f3\u5e93\u53ef\u4ee5\u7528\u54c8\u5e0c\u8868\u7ed3\u6784\u5b58\u50a8\uff0c\u8fd9\u91cc\u7528\u4e8c\u7ef4\u6570\u7ec4\u5b58\u50a8\u3002<\/p>\n

              string hashs[<\/span>Max_size]<\/span>[<\/span>Max_size]<\/span>;<\/span>\/\/\u62fc\u97f3\u5e93hashs\u8868<\/span>\n<\/code><\/pre>\n

              C++\u5904\u7406\u62fc\u97f3\u5e93\uff08\u4e0d\u5982Java\u548cC#\u65b9\u4fbf\uff09\uff0c\u6211\u91c7\u7528\u7684\u62fc\u97f3\u8868\u6211\u63d0\u524d\u5904\u7406\u8fc7\uff0c\u6211\u5728\u8fd9\u91cc\u7ed9\u51fa\u8d44\u6e90\u94fe\u63a5\u3002\uff08\u5927\u5bb6\u4e0b\u8f7d\u4fdd\u5b58\u4e3atxt\u6587\u4ef6\uff0c\u8bbe\u7f6eANSI\u7f16\u7801\u683c\u5f0f\uff09<\/p>\n

              \u62fc\u97f3\u5e93\u6587\u4ef6\u4e0b\u8f7d-csdn<\/p>\n

              \u8bfb\u53d6\u62fc\u97f3\u8868\u7684\u65b9\u5f0f\uff08\u6211\u7684\u65b9\u5f0f\uff0c\u5927\u5bb6\u53ef\u4ee5\u53c2\u8003\uff0c\u907f\u514d\u5927\u5bb6\u8e29\u5751\uff01\uff09<\/p>\n

              \/\/\u521d\u59cb\u5316hashs\u62fc\u97f3\u5e93\u8868<\/span>\nvoid<\/span> initHashMap<\/span>(<\/span>)<\/span> { \n   <\/span>\n\tstring str;<\/span>\n\tifstream inf;<\/span>\n\t\/\/\u4fdd\u5b58\u4e3aANSI\u7f16\u7801\u683c\u5f0f<\/span>\n\tinf.<\/span>open<\/span>(<\/span>\"yinjie.txt\"<\/span>)<\/span>;<\/span>\n\twhile<\/span> (<\/span>getline<\/span>(<\/span>inf,<\/span> str)<\/span>)<\/span> { \n   <\/span>\n\t\t\/\/cout << str << endl;<\/span>\n\t\tint<\/span> a1 =<\/span> str[<\/span>0<\/span>]<\/span>;<\/span>\n\t\tint<\/span> a0 =<\/span> str[<\/span>1<\/span>]<\/span>;<\/span>\n\t\ta1 =<\/span> -<\/span>a1;<\/span>\n\t\ta0 =<\/span> -<\/span>a0;<\/span>\n\t\tstring str1;<\/span>\n\t\tstr1 =<\/span> str.<\/span>substr<\/span>(<\/span>2<\/span>,<\/span> str.<\/span>length<\/span>(<\/span>)<\/span> -<\/span> 2<\/span>)<\/span>;<\/span>\n\t\tstring str3 =<\/span> str1;<\/span>\n\t\thashs[<\/span>a1]<\/span>[<\/span>a0]<\/span> =<\/span> str3;<\/span>\n\t}<\/span>\n\tinf.<\/span>close<\/span>(<\/span>)<\/span>;<\/span>\n}<\/span>\n<\/code><\/pre>\n

              3.\u901a\u8baf\u5f55\u8868<\/h3>\n

              \u901a\u8baf\u5f55\u8868\u53ef\u4ee5\u722c\u53d6\u7f51\u4e0a\u7684\u540d\u5b57\u6570\u636e\uff08\u4fdd\u8bc1\u4e0d\u72af\u6cd5\u7684\u524d\u63d0\u4e0b\uff09\uff0c\u6216\u8005\u81ea\u5df1\u5199\u4e00\u4e2a\u540d\u5b57\u751f\u6210\u51fd\u6570\uff0c\u51c6\u5907\u597d\u59d3\u540d\u7684\u5e38\u7528\u5b57\u8868\uff0c\u6309\u7167\u4e00\u5b9a\u7684\u89c4\u5219\u751f\u6210\u3002\u5728\u8fd9\u4e3a\u4e86\u6d4b\u8bd5\u7b80\u5355\u76f4\u63a5\u5199\u5b57\u7b26\u4e32\u6570\u7ec4\u5b58\u50a8\u3002<\/p>\n

              string peopleTable[<\/span>6<\/span>]<\/span>;<\/span>\/\/\u8054\u7cfb\u4eba\u8868<\/span>\n\/\/\u521d\u59cb\u5316\u901a\u8baf\u5f55\u8868<\/span>\nvoid<\/span> initPeopleTable<\/span>(<\/span>)<\/span> { \n   <\/span>\n\tpeopleTable[<\/span>0<\/span>]<\/span> =<\/span> \"\u5173\u4e91\u957f\"<\/span>;<\/span>\n\tpeopleTable[<\/span>1<\/span>]<\/span> =<\/span> \"\u4e01\u4e91\u957f\"<\/span>;<\/span>\n\tpeopleTable[<\/span>2<\/span>]<\/span> =<\/span> \"\u4e01\u4e50\u4e50\"<\/span>;<\/span>\n\tpeopleTable[<\/span>3<\/span>]<\/span> =<\/span> \"\u5f20\u4e09\"<\/span>;<\/span>\n\tpeopleTable[<\/span>4<\/span>]<\/span> =<\/span> \"\u674e\u56db\"<\/span>;<\/span>\n\tpeopleTable[<\/span>5<\/span>]<\/span> =<\/span> \"\u8fea\u4e3d\u70ed\u5df4\"<\/span>;<\/span>\n}<\/span>\n<\/code><\/pre>\n

              \u4e09\u3001\u62fc\u97f3\u6a21\u7cca\u5339\u914d\u7684\u9012\u5f52\u56de\u6eaf\u7b97\u6cd5<\/h2>\n

              1.\u62fc\u97f3\u5339\u914d\u5904\u7406\u51fd\u6570<\/h3>\n

              \u5728\u6b63\u5f0f\u8fdb\u5165\u9012\u5f52\u53bb\u5339\u914d\u4e4b\u524d\uff0c\u9700\u8981\u63d0\u524d\u505a\u4e00\u4e9b\u5de5\u4f5c\uff0c\u90a3\u4e48\u6211\u4eec\u4e0d\u5982\u5c31\u628a\u63d0\u524d\u505a\u7684\u5de5\u4f5c\u5355\u72ec\u5199\uff0c\u6838\u5fc3\u7684\u9012\u5f52\u56de\u6eaf\u7684\u7b97\u6cd5\u5355\u72ec\u62bd\u8c61\u51fa\u53bb\u5199\uff0c\u8fd9\u6837\u4e5f\u63d0\u9ad8\u7684\u7b97\u6cd5\u7684\u590d\u7528\u6027\uff0c\u5e76\u4e14\u4e5f\u65b9\u4fbf\u7b97\u6cd5\u4fee\u6539\u548c\u91cd\u6784\u3002<\/p>\n

              \u63d0\u524d\u505a\uff1a<\/p>\n

                \n
              1. \u8c03\u7528\u6bcf\u4e2a\u6c49\u5b57\u8f6c\u62fc\u97f3\u7684\u63a5\u53e3\uff0c\u8fd9\u90e8\u5206\u7684\u76f8\u5173\u5904\u7406\u4e0d\u8981\u9012\u5f52\u5b9e\u73b0\u53ea\u9700\u8981\u505a\u4e00\u6b21\u3002<\/li>\n
              2. \u5982\u679c\u540d\u5b57\u4e2d\u6709\u591a\u97f3\u5b57\u8981\u6bcf\u6b21\u6309\u540d\u5b57\u987a\u5e8f\u548c\u62fc\u97f3\u5e93\u4e2d\u7684\u97f3\u8282\u987a\u5e8f\u6bcf\u6b21\u4ea7\u751f\u65b0\u7684\u7ec4\u5408\u3002<\/li>\n
              3. \u2026<\/li>\n<\/ol>\n

                \u8be5\u51fd\u6570\u7c7b\u578b\u4e3abool\uff0c\u88ab\u8c03\u7528\u8fd4\u56de\u5f97\u5230\u5339\u914d\u8fd8\u662f\u672a\u5339\u914d\u7684\u7ed3\u679c\u3002
                \u8be5\u51fd\u6570\u7684\u6d41\u7a0b\u56fe\u5982\u4e0b\uff1a
                \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1\u4ee3\u7801\uff1a
                \uff08\u8fd9\u91cc\u672a\u7ed9\u51fa\u5904\u7406\u591a\u97f3\uff0c\u591a\u97f3\u5219\u662f\u5728\u8be5\u5904\u7406\u51fd\u6570\u4e2d\u589e\u52a0\u97f3\u8282\u7684\u6392\u5217\u7ec4\u5408\uff0c\u5b9e\u73b0\u65b9\u5f0f\u5f88\u591a\uff1a\u53ef\u4ee5\u6bcf\u6b21\u4ece\u6bcf\u4e2a\u5b57\u7684\u97f3\u8282\u4e2d\u622a\u65ad\u53d6\u4e00\u4e2a\u5904\u7406\u554a\u751f\u6210\u7ec4\u5408\uff0c\u8c03\u7528\u6838\u5fc3\u7b97\u6cd5\u5339\u914d\uff1b\u4e5f\u53ef\u4ee5\u63d0\u524d\u53d6\u751f\u6210\u6bcf\u4e2a\u540d\u5b57\u7684\u591a\u4e2a\u97f3\u8282\u7ec4\u5408\uff1b\uff09
                \u63d0\u793a\uff1a\u63a8\u8350\u5927\u5bb6\u5904\u7406\u4e00\u4e2a\u540d\u5b57\u7684\u591a\u97f3\u7ec4\u5408\u65f6\u4ea7\u751f\u4e00\u4e2a\u5c31\u5339\u914d\u4e00\u4e2a\uff0c\u8fd9\u6837\u4f1a\u51cf\u5c11\u5f88\u591a\u7684\u6392\u5217\u7ec4\u5408\u7684\u4ee3\u4ef7\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u628a\u540d\u5b57\u4e2d\u5bf9\u5e94\u4f4d\u7f6e\u7684\u5e38\u7528\u97f3\u8282\u5728\u62fc\u97f3\u5e93\u8868\u4e2d\u505a\u8c03\u6574\uff0c\u8fd9\u6837\u4e5f\u53ef\u4ee5\u5927\u5e45\u63d0\u9ad8\u641c\u7d22\u5339\u914d\u7684\u65f6\u95f4\u3002<\/code><\/p>\n

                \/\/\u4e0d\u5b8c\u5168\u62fc\u97f3\u6a21\u7cca\u5339\u914d(\u4e0d\u5904\u7406\u591a\u97f3\u5b57)<\/span>\nbool<\/span> PinyinMatch<\/span>(<\/span>string search,<\/span> string name)<\/span> { \n   <\/span>\n\tStringList pinyinItem;<\/span>\n\tfor<\/span> (<\/span>int<\/span> i =<\/span> 0<\/span>;<\/span> i <<\/span> name.<\/span>length<\/span>(<\/span>)<\/span>;<\/span> i +=<\/span> 2<\/span>)<\/span> { \n   <\/span>\n\t\tstring s =<\/span> getYinJie<\/span>(<\/span>name.<\/span>substr<\/span>(<\/span>i,<\/span> 2<\/span>)<\/span>)<\/span>;<\/span>\/\/\u4ece\u62fc\u97f3\u8868\u4e2d\u83b7\u5f97\u97f3\u8282\u5b57\u7b26\u4e32<\/span>\n\t\t\/\/cout << s.length() << endl;\/\/\u9a8c\u8bc1\u4e00\u4e0b\u5b58\u8fdb\u53bb\u7684\u5b57\u7b26\u4e32\u957f\u5ea6,\u662f\u5426\u622a\u65ad<\/span>\n\t\tint<\/span> pos =<\/span> 0<\/span>;<\/span>\n\t\tfor<\/span> (<\/span>int<\/span> j =<\/span> 0<\/span>;<\/span> j <<\/span> s.<\/span>length<\/span>(<\/span>)<\/span>;<\/span> j++<\/span>)<\/span> { \n   <\/span>\n\t\t\t\/\/\u5224\u65ad\u662f\u5426\u542b\u6709\u7a7a\u683c\uff0c\u8fd9\u91cc\u4e0d\u8003\u8651\u591a\u97f3\u5b57\uff0c\u76f4\u63a5\u5728\u7b2c\u4e00\u4e2a\u7a7a\u683c\u5904\u622a\u65ad\u53d6\u7b2c\u4e00\u4e2a\u8bfb\u97f3<\/span>\n\t\t\tif<\/span> (<\/span>s[<\/span>j]<\/span> ==<\/span> ' '<\/span>)<\/span> { \n   <\/span> pos =<\/span> j;<\/span> break<\/span>;<\/span> }<\/span>\n\t\t}<\/span>\n\t\tif<\/span> (<\/span>pos ==<\/span> 0<\/span>)<\/span> pinyinItem.<\/span>append<\/span>(<\/span>s)<\/span>;<\/span>\/\/\u4e0d\u542b\u7a7a\u683c\uff0c\u76f4\u63a5\u5b58\u5165pinyinItem[]<\/span>\n\t\telse<\/span> { \n   <\/span>\n\t\t\tstring yinjie =<\/span> s.<\/span>substr<\/span>(<\/span>0<\/span>,<\/span> pos)<\/span>;<\/span>\/\/\u542b\u7a7a\u683c\uff0c\u622a\u65ad\u4ee5\u540e\u5b58\u5165pinyinItem[]<\/span>\n\t\t\tpinyinItem.<\/span>append<\/span>(<\/span>yinjie)<\/span>;<\/span>\n\t\t}<\/span>\n\t}<\/span>\n\tpinyinItem.<\/span>show<\/span>(<\/span>)<\/span>;<\/span>\/\/\u8f93\u51fa\u97f3\u8282\u8868\u6d4b\u8bd5<\/span>\n\t\n\t\/\/\u8c03\u7528\u5339\u914d\u6838\u5fc3\u7b97\u6cd5<\/span>\n\tif<\/span> (<\/span>Match<\/span>(<\/span>search,<\/span> 0<\/span>,<\/span> pinyinItem,<\/span> 0<\/span>,<\/span> 0<\/span>)<\/span> ==<\/span> true<\/span>)<\/span> return<\/span> true<\/span>;<\/span>\/\/\u5982\u679c\u5339\u914d\u7b97\u6cd5\u901a\u8fc7\uff0c\u8ba4\u4e3a\u8be5\u6761\u8bb0\u5f55\u5339\u914d\u901a\u8fc7\uff0c\u8fd4\u56detrue<\/span>\n\treturn<\/span> false<\/span>;<\/span>\/\/\u5339\u914d\u672a\u901a\u8fc7\u8fd4\u56defalse<\/span>\n\n\t\/\/\u5c4f\u853d\u6838\u5fc3\u7b97\u6cd5\u6d4b\u8bd5pyItem\uff0c\u76f4\u63a5return true<\/span>\n\t\/\/return true;<\/span>\n}<\/span>\n<\/code><\/pre>\n

                2.\u62fc\u97f3\u6a21\u7cca\u5339\u914d\u6838\u5fc3\u9012\u5f52\u56de\u6eaf\uff08Match\uff09<\/h3>\n

                \u9996\u5148\u4e86\u89e3\u6211\u7684Match\u51fd\u6570\u7684\u57fa\u7840\u601d\u60f3\u3002\u8be5\u5339\u914d\u51fd\u6570\u9700\u8981\u4f20\u5165\u8f93\u5165\u7684\u5f85\u5339\u914d\u7684\u5b57\u7b26\u4e32\uff0c\u4ee5\u53ca\u540d\u5b57\u8f6c\u62fc\u97f3\u97f3\u8282\u540e\u7684\u5b58\u50a8\u7684\u987a\u5e8f\u8868\u3002\u7136\u540e\u6839\u636e\u9012\u5f52\u56de\u6eaf\u539f\u7406\u8fdb\u884c\u5339\u914d\u3002<\/p>\n

                \u9996\u5148\u770b\u4e00\u4e0b\u539f\u7406\uff1a
                \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1\u4ee5\u8f93\u5165\u201cguanyucha\u201d\u5339\u914d\u201c\u5173\u4e91\u957f\u201d\u4e3a\u4f8b\uff0c\u201c\u5173\u4e91\u957f\u201d\u5728\u5de5\u5177\u51fd\u6570pinyinMatch\u4e2d\u5f97\u5230pyItem\u4e3a\u201cguan\u201d\u201cyun\u201d\u201cchang\u201d\uff0c\u7136\u540e\u9996\u5148\u8fdb\u884c\u201cguanyucha\u201d\u7684\u9996\u5b57\u6bcd\u2018g\u2019\u4e0e\u201cguan\u201d\u6bd4\u8f83\u76f8\u7b49\u540e\uff0c\u9012\u5f52\uff0c\u2019u\u2019,\u2019a\u2019,\u2019n\u2019\u5206\u522b\u7ee7\u7eed\u5339\u914d\u201cguan\u201d\uff0c\u8be5\u5c42\u5339\u914d\u7ed3\u675f\u540e\uff0c\u7ee7\u7eed\u5339\u914d\u2019y\u2019\u4e0e\u201cyun\u201d\u7684\u9996\u5b57\u6bcd\u5339\u914d\uff0c\u5339\u914d\u5230\u2019c\u2019\u65e0\u6cd5\u7ee7\u7eed\u5728\u201cyun\u201d\u4e2d\u5339\u914d\uff0c\u8fdb\u5165pyItem\u7684\u4e0b\u4e00\u4e2a\u5143\u7d20\u201cchang\u201d\u5339\u914d\u4e4b\u540e\u7684\u5143\u7d20\uff0c\u5339\u914d\u5230\u2019a\u2019\u7ed3\u675f\u5339\u914d\uff0c\u8fd4\u56detrue\u6807\u5fd7\u5339\u914d\u6210\u529f\u3002<\/p>\n

                \u63d0\u793a\uff1a\u6838\u5fc3\u6838\u5fc3\u6838\u5fc3\uff01\uff01\uff01<\/code>
                \u6bcf\u6b21\u4f20\u5165Match\u51fd\u6570\u4e2d\u7684\u53c2\u6570\u6709\uff1a<\/p>\n

                  \n
                1. string\u7c7b\u578bsearch\uff08\u5f85\u5339\u914d\u7684\u62fc\u97f3\u5b57\u7b26\u4e32\uff09<\/li>\n
                2. int\u7c7b\u578b\u7684searchIndex\uff08\u5f53\u524d\u641c\u7d22\u5230\u62fc\u97f3\u5b57\u7b26\u4e32\u7684\u4f4d\u7f6e\uff0c\u7406\u89e3\u4e3a\u62fc\u97f3\u5b57\u7b26\u4e32\u7684\u201c\u6307\u9488\u201d\uff09<\/li>\n
                3. StringList\u7c7b\u578b\u7684pyItem\uff08\u751f\u6210\u7684\u5f53\u524d\u626b\u63cf\u5230\u540d\u5b57\u7684\u4e00\u4e2a\u97f3\u8282\u7ec4\u5408\u8868\uff09<\/li>\n
                4. int\u7c7b\u578b\u7684yinjieIndex\uff08\u97f3\u8282\u8868\u7684\u7b2c\u51e0\u5c42\uff0c\u6bd4\u5982\uff1a\u201cguan\u201d\u7b2c\u4e00\u5c42\uff0c\u201cyun\u201d\u7b2c\u4e8c\u5c42\uff09<\/li>\n
                5. int\u7c7b\u578b\u7684yinjieStart\u3002\uff08\u97f3\u8282\u7684\u7b2c\u51e0\u4e2a\u5b57\u7b26\uff0c\u6bd4\u5982\uff1a'g\u2019\u4e3ayinjieIndex=0,yinjieStart=0\u65f6\u7684\u5b57\u7b26\uff09<\/li>\n<\/ol>\n

                  \u9012\u5f52\u56de\u6eaf\u56fe\uff1a
                  \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1\u9012\u5f52\u56de\u6eaf\u90e8\u5206\uff1a<\/p>\n

                  \/\/\u5339\u914d\u7b97\u6cd5(\u9012\u5f52\u56de\u6eaf)<\/span>\nbool<\/span> Match<\/span>(<\/span>string search,<\/span>int<\/span> searchIndex,<\/span>StringList pyItem,<\/span>int<\/span> yinjieIndex,<\/span>int<\/span> yinjieStart)<\/span> { \n   <\/span>\n\t\/\/\u8fd9\u4e2aif\u662f\u89c4\u5b9a\u7b2c\u4e00\u4e2a\u9996\u5b57\u6bcd\u5fc5\u987b\u5339\u914d\u7684\u4e00\u79cd\u5339\u914d\u65b9\u6cd5\uff0c\u4f8b\u5982yc\u662f\u5339\u914d\u4e0d\u5230gyc\u7684<\/span>\n\t\/\/if (searchIndex == 0)\/\/\u5982\u679c\u5728\u8f93\u5165\u7684search[]\u7684\u7b2c\u4e00\u4e2a\u5b57\u6bcd\u4f4d\u7f6e<\/span>\n\t\/\/ \/\/\u7b2c\u4e00\u4e2a\u5fc5\u987b\u5339\u914d&&\u5982\u679c\u53ea\u6709\u4e00\u4e2a\u5b57\u7b26\uff0c\u7b97\u5339\u914d\u6210\u529f\uff0c\u5426\u5219\u4ece\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u5f00\u59cb\u6bd4\u8f83,\u8fdb\u5165\u4e0b\u4e00\u5c42\u9012\u5f52<\/span>\n\t\/\/ return search[0] == pyItem.getItem(0)[0] && (search.length() == 1 || Match(search, 1, pyItem, 0, 1));<\/span>\n\n\t\/\/\u8fd9\u91cc\u5904\u7406\u5982\u679cguan yun chang\uff0cyc\u53ef\u4ee5\u5339\u914d\uff0cc\u4e0d\u80fd\u5339\u914d<\/span>\n\tif<\/span> (<\/span>searchIndex ==<\/span> 0<\/span>)<\/span> { \n   <\/span>\n\t\tif<\/span> (<\/span>yinjieIndex ><\/span> pyItem.<\/span>length -<\/span> 1<\/span>)<\/span> return<\/span> false<\/span>;<\/span>\n\t\tstartFloorIndex++<\/span>;<\/span>\n\t\treturn<\/span> search[<\/span>0<\/span>]<\/span> ==<\/span> pyItem.<\/span>getItem<\/span>(<\/span>yinjieIndex)<\/span>[<\/span>0<\/span>]<\/span> ?<\/span> Match<\/span>(<\/span>search,<\/span> 1<\/span>,<\/span> pyItem,<\/span> yinjieIndex,<\/span> 1<\/span>)<\/span> :<\/span> Match<\/span>(<\/span>search,<\/span> 0<\/span>,<\/span> pyItem,<\/span> yinjieIndex +<\/span> 1<\/span>,<\/span> 0<\/span>)<\/span>;<\/span>\n\t}<\/span>\n\t\/\/\u5224\u65ad\u4e0d\u8d8a\u754c&&\u5224\u65ad\u5339\u914d<\/span>\n\tif<\/span> (<\/span>pyItem.<\/span>getItem<\/span>(<\/span>yinjieIndex)<\/span>.<\/span>length<\/span>(<\/span>)<\/span> ><\/span> yinjieStart &&<\/span> search[<\/span>searchIndex]<\/span> ==<\/span> pyItem.<\/span>getItem<\/span>(<\/span>yinjieIndex)<\/span>[<\/span>yinjieStart]<\/span>)<\/span>\n\t\t\/\/\u5982\u679c\u8fd9\u662f\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\uff0c\u68c0\u67e5\u4e4b\u524d\u7684\u58f0\u6bcd\u662f\u5426\u4f9d\u6b21\u51fa\u73b0<\/span>\n\t\t\/\/\u5982\u679c\u4e0d\u662f\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\uff0c\u540c\u4e00\u4e2a\u5b57\u7684\u62fc\u97f3\u8fde\u7eed\u5339\u914d<\/span>\n\t\treturn<\/span> searchIndex ==<\/span> search.<\/span>length<\/span>(<\/span>)<\/span> -<\/span> 1<\/span> ?<\/span> keyMatch<\/span>(<\/span>search,<\/span> pyItem,<\/span> yinjieIndex)<\/span> :<\/span> Match<\/span>(<\/span>search,<\/span> searchIndex +<\/span> 1<\/span>,<\/span> pyItem,<\/span> yinjieIndex,<\/span> yinjieStart +<\/span> 1<\/span>)<\/span>;<\/span>\n\t\/\/\u5224\u65ad\u4e0d\u8d8a\u754c&&\u4e0d\u80fd\u62fc\u97f3\u8fde\u7eed\u5339\u914d\u7684\u60c5\u51b5\u4e0b\uff0c\u770b\u770b\u4e0b\u4e00\u4e2a\u5b57\u7684\u62fc\u97f3\u7684\u9996\u5b57\u6bcd\u80fd\u5426\u5339\u914d<\/span>\n\telse<\/span> if<\/span> (<\/span>pyItem.<\/span>length ><\/span> yinjieIndex +<\/span> 1<\/span> &&<\/span> search[<\/span>searchIndex]<\/span> ==<\/span> pyItem.<\/span>getItem<\/span>(<\/span>yinjieIndex +<\/span> 1<\/span>)<\/span>[<\/span>0<\/span>]<\/span>)<\/span>\n\t\t\/\/\u5982\u679c\u8fd9\u662f\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\uff0c\u68c0\u67e5\u4e4b\u524d\u7684\u58f0\u6bcd\u662f\u5426\u4f9d\u6b21\u51fa\u73b0<\/span>\n\t\t\/\/\u5982\u679c\u4e0d\u662f\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\uff0c\u53bb\u5224\u65ad\u4e0b\u4e00\u4e2a\u5b57\u62fc\u97f3\u7684\u7b2c\u4e8c\u4e2a\u5b57\u6bcd<\/span>\n\t\treturn<\/span> searchIndex ==<\/span> search.<\/span>length<\/span>(<\/span>)<\/span> -<\/span> 1<\/span> ?<\/span> keyMatch<\/span>(<\/span>search,<\/span> pyItem,<\/span> yinjieIndex)<\/span> :<\/span> Match<\/span>(<\/span>search,<\/span> searchIndex +<\/span> 1<\/span>,<\/span> pyItem,<\/span> yinjieIndex +<\/span> 1<\/span>,<\/span> 1<\/span>)<\/span>;<\/span>\n\telse<\/span> if<\/span> (<\/span>pyItem.<\/span>length ><\/span> yinjieIndex +<\/span> 1<\/span>)<\/span>\/\/\u56de\u9000<\/span>\n\t\tfor<\/span> (<\/span>int<\/span> i =<\/span> 1<\/span>;<\/span> i <<\/span> searchIndex;<\/span> i++<\/span>)<\/span>\n\t\t\tif<\/span> (<\/span>Match<\/span>(<\/span>search,<\/span> searchIndex -<\/span> i,<\/span> pyItem,<\/span> yinjieIndex +<\/span> 1<\/span>,<\/span> 0<\/span>)<\/span>)<\/span> return<\/span> true<\/span>;<\/span>\n\treturn<\/span> false<\/span>;<\/span>\n}<\/span>\n<\/code><\/pre>\n

                  \u63d0\u793a\uff1a\u4ee3\u7801\u4e2d\u7684keyMatch\u51fd\u6570\u540e\u9762\u4f1a\u89e3\u91ca\uff0c\u5148\u8bf4\u8981\u6ce8\u610f\u7684\u4e24\u4e2a\u70b9\uff01<\/code>
                  \u9012\u5f52\u56de\u6eaf\u7b97\u6cd5\u8bbe\u8ba1\u2014\u2014\u5904\u7406\u51e0\u79cd\u4e0d\u5339\u914d\u8fd4\u56defalse\u7684\u60c5\u51b5\uff1a<\/p>\n

                    \n
                  1. \u5f85\u5339\u914d\u5b57\u7b26\u4e32\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e0e\u6bcf\u4e2a\u97f3\u8282\u7684\u9996\u5b57\u6bcd\u90fd\u4e0d\u5339\u914d\uff0c\u5c31\u4f1a\u5728\u9012\u5f52\u6b21\u6570\u8fbe\u5230\u97f3\u8282\u6570\u4e4b\u540e\u76f4\u63a5\u8df3\u51fa\u3002<\/li>\n
                  2. \u5339\u914d\u5230\u5f85\u5339\u914d\u5b57\u7b26\u4e32\u7684\u6700\u540e\uff0c\u68c0\u9a8c\u4e4b\u524d\u7684\u6bcf\u4e2a\u97f3\u8282\u7684\u9996\u5b57\u6bcd\u6309\u987a\u5e8f\u4f9d\u6b21\u51fa\u73b0\u3002\u4e0d\u4f9d\u6b21\u51fa\u73b0\u8fd4\u56defalse\u3002<\/li>\n
                  3. \u5176\u4ed6\uff1a\u201cguanyunchang123\u201d\u201cguanchang\u201d\u201cgc\u201d\u5339\u914d\u4e0d\u5230<\/li>\n<\/ol>\n

                    \u5339\u914d\u7b97\u6cd5\u7684\u5b8c\u5584\u2014\u2014\u4e0d\u80fd\u201c\u622a\u65ad\u5339\u914d\u201d\uff1a
                    \u4f8b\uff1a\u5173\u4e91\u957f\u2014\u7528\u201cgy\u201d\uff0c\u201cyc\u201d\u53ef\u641c\u7d22\uff0c\u7528\u201cgc\u201d\u4e0d\u53ef\u641c\u7d22\u3002
                    (\u5b9e\u73b0\u539f\u7406\u4e0e\u9996\u5b57\u6bcd\u7684\u5339\u914d\u539f\u7406\u4e00\u81f4\uff0c\u5224\u65ad\u6b64\u8bb0\u5f55\u7684\u6bcf\u4e2a\u6c49\u5b57\u7684\u97f3\u8282\u7684\u9996\u5b57\u6bcd\u662f\u5426\u5728\u641c\u7d22\u62fc\u97f3\u4e2d\u51fa\u73b0\u8fc7,\u4e14\u6309\u7167\u987a\u5e8f\u51fa\u73b0,\u7528\u641c\u7d22\u5b57\u7b26\u63a7\u5236\u5224\u65ad\u6b21\u6570\u3002)<\/p>\n

                    \u63d0\u793a\uff1a\u770b\u4e0d\u61c2\u9012\u5f52\u56de\u6eaf\u56fe\u7684\uff0c\u6211\u518d\u89e3\u91ca\u4e00\u4e0b\uff0c\u770b\u61c2\u7684\u8df3\u8fc7\u3002<\/code><\/p>\n

                      \n
                    1. \u5982\u679c\u641c\u7d22\u4e3a\u5173\u4e91\uff0c\u201cgy\u201c\u5219\u5224\u65ad\u4e24\u6b21\uff0c\u5728\u201cguan\u201d,\u201dyun\u201d\u4e2d\u5224\u65adgy\u90fd\u51fa\u73b0\u8fc7\u5219\u8fd4\u56detrue\u5339\u914d\u3002<\/li>\n
                    2. \u82e5\u8f93\u5165\u201cyc\u201d\u56e0\u4e3a\u4e0e\u201dguan\u201d\u9996\u5b57\u6bcd\u4e0d\u5339\u914d\u5219\u8df3\u5230\u201dyun\u201d\uff0c\u201cchang\u201d\u5339\u914d\uff0c\u5339\u914d\u6210\u529f\u8fd4\u56detrue\u3002<\/li>\n
                    3. \u82e5\u8f93\u5165\u4e3a\u201cgc\u201d\u5219\u201dg\u201d\u4e0e\u201dguan\u5339\u914d\u201cc\u2019\u2019\u4e0e\u201cyun\u201d\u4e0d\u5339\u914d\u8fd4\u56defalse\u3002\u5219\u6b64\u601d\u60f3\u53ef\u5b9e\u73b0\u4e0d\u80fd\u622a\u65ad\u5339\u914d\u3002<\/li>\n
                    4. \u5bf9\u6a21\u7cca\u5339\u914d\u7684\u5b8c\u5584\uff08\u9996\u5b57\u6bcd\u6309\u5e8f\u5339\u914d\uff09\uff0c\u4f8b\u5982\u641c\u7d22\u201dguanun\u201d\u5219\u201cguan\u201d\u5339\u914d\uff0c\u8fdb\u5165\u201cyun\u201c\u56e0\u4e3a\u9996\u5b57\u6bcd\u4e0d\u5339\u914d\uff0c\u6545\u8fd4\u56defalse\u3002\u82e5\u6ca1\u6709\u9996\u5b57\u6bcd\u5339\u914d\u529f\u80fd\uff0c\u5b58\u5728\u201dguanun\u201d\u4e2d\u201dun\u201d\u4e5f\u53ef\u8fdb\u5165\u5339\u914d\u5e76\u4e14\u5339\u914d\u6210\u529f\u663e\u793a\uff0c\u8fd9\u4e2a\u95ee\u9898\u8981\u907f\u514d\u3002<\/li>\n<\/ol>\n

                      \u8f85\u52a9\u5339\u914d\u90e8\u5206\uff08\u68c0\u9a8c\u4f5c\u7528\uff09\uff1a<\/p>\n

                      \/\/\u8f85\u52a9\u53d8\u91cf\uff1a\u7528\u4e8e\u53d6\u5230\u5728\u8f85\u52a9\u51fd\u6570\u4e2d\u7b2c\u51e0\u5c42\u5f00\u59cb\u5224\u65ad\u6bcf\u4e2a\u97f3\u8282\u9996\u5b57\u6bcd\u987a\u5e8f<\/span>\nint<\/span> startFloorIndex =<\/span> -<\/span>1<\/span>;<\/span>\n\n\/\/\u8f85\u52a9\u5339\u914d\u51fd\u6570,\u786e\u4fddpyItem.getItem(n)[0]\u90fd\u6309\u7167\u987a\u5e8f\u51fa\u73b0<\/span>\n\/\/\u9632\u6b62guan yu chang\u5339\u914dgc(\u8df3\u8fc7\u4e86yu\u8fbe\u5230\u5339\u914d\u7684\u8fd9\u79cd\u60c5\u51b5)<\/span>\nbool<\/span> keyMatch<\/span>(<\/span>string search,<\/span>StringList pyItem,<\/span>int<\/span> yinjieIndex)<\/span> { \n   <\/span>\n\tint<\/span> lastIndex =<\/span> 0<\/span>;<\/span>\n\tint<\/span> i;<\/span>\/\/i\u4ee3\u8868\u5f00\u59cb\u7684\u5c42\u6570<\/span>\n\tfor<\/span> (<\/span>i =<\/span> startFloorIndex;<\/span> i <<\/span> yinjieIndex +<\/span> startFloorIndex;<\/span> i++<\/span>)<\/span> { \n   <\/span>\n\t\tlastIndex =<\/span> IndexOf<\/span>(<\/span>search,<\/span> pyItem.<\/span>getItem<\/span>(<\/span>i)<\/span>[<\/span>0<\/span>]<\/span>,<\/span> lastIndex)<\/span>;<\/span>\n\t\tif<\/span> (<\/span>lastIndex ==<\/span> -<\/span>1<\/span>)<\/span> return<\/span> false<\/span>;<\/span>\n\t\tlastIndex++<\/span>;<\/span>\n\t}<\/span> \n\treturn<\/span> true<\/span>;<\/span>\n}<\/span>\n<\/code><\/pre>\n
                        \n
                      1. \u9996\u5148\u9700\u8981\u4e00\u4e2agetIndexof\u51fd\u6570\u5f97\u5230\u67d0\u4e2a\u5b57\u6bcd\u5728\u62fc\u97f3\u4e2d\u7684\u4f4d\u7f6e\u3002\u53ea\u662f\u5224\u65ad\u5728\u97f3\u8282\u4e2d\u6709\u6ca1\u6709\u51fa\u73b0\u8fc7\u3002<\/li>\n
                      2. \u8bbe\u7f6e\u8f85\u52a9\u51fd\u6570\u7684\u539f\u56e0\uff1a\u6bcf\u6b21\u5224\u65ad\u65f6\u9700\u8981\u77e5\u9053\u6b64\u6761\u8bb0\u5f55\u6bcf\u4e2a\u6c49\u5b57\u9996\u5b57\u6bcd\u662f\u5426\u5728\u641c\u7d22\u62fc\u97f3\u4e2d\u51fa\u73b0\u8fc7\uff0c\u82e5\u51fa\u73b0\u8fc7\u5f97\u5230\u6b64\u4f4d\u7f6e\uff0c\u82e5\u672a\u51fa\u73b0\u8fc7\u8fd4\u56de-1\uff1b<\/li>\n
                      3. keyMatch\u7b97\u6cd5\u5b9e\u73b0\u6839\u636e\u4e0a\u8ff0\u539f\u7406\u8bbe\u7f6e\u4e00\u4e2a\u5c42\u6570int startFloorIndex = -1\uff1b\u907f\u514d\u91cd\u590d\u5bf9\u67d0\u4e00\u4e2a\u6c49\u5b57\u7684\u97f3\u8282\u8fdb\u884c\u5339\u914d\u91cd\u590d\u9012\u5f52\u3002<\/li>\n
                      4. \u6bcf\u6b21\u5bf9\u4e00\u4e2a\u9996\u5b57\u6bcd\u5224\u65ad\u4e4b\u540e\u8fdb\u5165\u4e0b\u4e00\u4e2a\u6c49\u5b57\u7684\u9996\u5b57\u6bcd\u5339\u914d\u5faa\u73af\u76f4\u81f3\u6240\u6709\u641c\u7d22\u97f3\u8282\u5339\u914d\u5b8c\u6bd5\u3002<\/li>\n
                      5. \u82e5\u90fd\u6309\u7167\u987a\u5e8f\u51fa\u73b0\u5219\u8fd4\u56detrue\uff0c\u5426\u5219\u8fd4\u56defalse\u3002<\/li>\n<\/ol>\n

                        \u56db\u3001\u6211\u6700\u7ec8\u5b9e\u73b0\u7684\u6548\u679c<\/h2>\n

                        \u672c\u6765\u662f\u6ca1\u6709\u8fd9\u90e8\u5206\u7684\uff0c\u56e0\u4e3a\u672c\u7bc7\u535a\u5ba2\u4e5f\u53ea\u60f3\u9610\u8ff0\u7b97\u6cd5\u7684\u8bbe\u8ba1\u601d\u60f3\u3002\u4f46\u662f\u6211\u5bf9\u7136\u4e0d\u80fd\u5206\u4eab\u6211\u6574\u4e2a\u9879\u76ee\u7684\u6e90\u7801\u7ed9\u5927\u5bb6\uff0c\u4f46\u662f\u53ef\u4ee5\u7ed9\u5927\u5bb6\u6f14\u793a\u548c\u8bf4\u660e\u4e00\u4e0b\u6211\u5b9e\u73b0\u4e86\u6838\u5fc3\u7684\u7b97\u6cd5\u540e\uff0c\u6700\u7ec8\u7684\u6548\u679c\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u80fd\u6709\u542f\u53d1\uff0c\u6216\u8005\u53ef\u4ee5\u5f00\u53d1\u51fa\u53ef\u89c6\u5316\u7684\u754c\u9762\u8fbe\u5230\u66f4\u597d\u7684\u6548\u679c\u3002<\/p>\n

                        1.\u7ed3\u679c\u63cf\u8ff0<\/h3>\n
                          \n
                        1. \u6700\u7ec8\u7684\u4ee3\u7801\u91cf\u5171882\u884c\uff08\u5305\u542b\u7b80\u5355\u7684\u6d4b\u8bd5\u8bed\u53e5\uff09<\/li>\n
                        2. \u6700\u5927\u7684\u6d4b\u8bd5\u6570\u636e\u91cf\u8fbe\u523010000\u6761\u901a\u8baf\u5f55\uff0c\u6700\u957f\u641c\u7d22\u65f6\u95f4<1000ms\u3002<\/li>\n
                        3. \u524d\u9762\u968f\u673a\u751f\u6210\u548c\u52a0\u8f7d\u901a\u8baf\u5f55\u5230\u987a\u5e8f\u8868\u4e2d\u82b1\u8d39\u7684\u65f6\u95f4\u8f83\u957f\uff0c\u8fd9\u4e2a\u662f\u5f71\u54cd\u6027\u80fd\u7684\u5730\u65b9\u3002<\/li>\n
                        4. \u6700\u7ec8\u529f\u80fd\u7684\u8be6\u7ec6\u63cf\u8ff0\uff1a
                          \uff081\uff09\u5b9e\u73b0\u62fc\u97f3\u5e93\u7684\u5b58\u50a8\uff08\u4ee5\u6570\u7ec4\u5f62\u5f0f\uff09
                          \uff082\uff09\u5b9e\u73b0\u968f\u673a\u751f\u621010000\u6761\u901a\u8baf\u5f55\u6570\u636e\u5b58\u50a8\u5728\u7535\u8111\u6307\u5b9a\u4f4d\u7f6e\u7684\u6587\u672c\u6587\u4ef6\u4e2d\uff0c\u505a\u5230\u6570\u636e\u6301\u4e45\u5316\u3002\u540d\u5b57\u7684\u957f\u5ea62-4\u3002
                          \uff083\uff09\u5b9e\u73b0\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u7684\u591a\u97f3\u60c5\u51b5\uff0c\u6700\u591a\u652f\u6301\u56db\u4e2a\u5b57\u6bcf\u4e2a\u5b57\u5305\u542b\u56db\u4e2a\u591a\u97f3\uff08\u5728\u8fd9\u4e2a\u540d\u5b57\u7684\u5339\u914d\u4e2d\u4f1a\u4ea7\u751f256\u79cd\u7ec4\u5408\u7684\u60c5\u51b5\uff09
                          \uff084\uff09\u5b9e\u73b0\u901a\u8baf\u5f55\u4ece\u6587\u4ef6\u52a0\u8f7d\u5230\u987a\u5e8f\u8868\u540e\u987a\u5e8f\u5b58\u50a8\uff08\u9996\u5b57\u6bcd\u987a\u5e8f\u7b49\uff09\uff0c\u641c\u7d22\u7ed3\u679c\u663e\u793a\u6309\u7167\u9996\u5b57\u6bcd\u987a\u5e8f\uff08\u5982\u679c\u7b2c\u4e00\u4e2a\u5b57\u7684\u9996\u5b57\u6bcd\u76f8\u540c\u4f1a\u6309\u7167\u7b2c\u4e8c\u4e2a\u5b57\u7684\u9996\u5b57\u6bcd\u987a\u5e8f\u6392\u5e8f\uff0c\u5728\u641c\u7d22\u5339\u914d\u60c5\u51b5\u8f83\u591a\u65f6\uff0c\u987a\u5e8f\u6392\u5217\u4f1a\u6bd4\u8f83\u5bb9\u6613\u627e\u5230\u9700\u8981\u627e\u5230\u7684\u90a3\u4e2a\u4eba\uff0c\u7b26\u5408\u5b9e\u9645\u6211\u4eec\u73b0\u5728\u901a\u8baf\u5f55\u7684\u65b9\u5f0f\u3002)
                          \uff085\uff09\u7528\u6bd4\u8f83\u53d6\u5de7\u7684\u65b9\u6cd5\u5b9e\u73b0\u5206\u9694\u7b26\u5339\u914d\u7684\u529f\u80fd\u3002\u4f8b\u5982\u201cxi\u2019an\u201d\u5339\u914d\u201c\u897f\u5b89\u201d\u4e0d\u5339\u914d\u201c\u5148\u201d\u3002\u4ee5\u5206\u9694\u7b26\u5c06\u6574\u4e2a\u5b57\u7b26\u4e32\u5207\u5272\uff0c\u201cxi\u201d\u548c\u201can\u201d\u5206\u522b\u62ff\u8fdb\u53bb\u6a21\u7cca\u5339\u914d\uff0c\u5f53\u4e24\u4e2a\u5339\u914d\u7684\u7ed3\u679c\u90fd\u5339\u914d\u5230\u65f6\uff0c\u8fd4\u56de\u5bf9\u5e94\u7684\u8bb0\u5f55\u3002\uff08\u56e0\u4e3a\u201can\u201d\u9996\u5b57\u6bcd\u5339\u914d\u4e0d\u5230\u201cxian\u201d\uff0c\u6240\u4ee5\u201cxi\u2019an\u201d\u5339\u914d\u4e0d\u5230\u201c\u5148\u201d\uff0c\u7c7b\u4f3c\u8f93\u5165\u6cd5\u91cc\u7684\u529f\u80fd\uff09\u3002<\/li>\n<\/ol>\n

                          2.\u6d4b\u8bd5<\/h3>\n

                          \u8fd0\u884c\u5f00\u59cb\uff0c\u5728\u6307\u5b9a\u4f4d\u7f6e\u751f\u6210\u901a\u8baf\u5f55\uff08\u968f\u673a10000\u6761\uff09\u3002
                          \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1\u4ee5\u201c\u957f\u4e50\u5b81\u201d\u4e3a\u4f8b\uff0c\u8f93\u5165\u201ccln\u201d\uff0c\u5f97\u5230\u201c\u957f\u4e50\u5b81\u201d\u3002
                          \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1
                          \u8f93\u5165\u201czhanglening\u201d\uff0c\u5f97\u5230\u201c\u957f\u4e50\u5b81\u201d\u3002
                          \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1
                          \u8f93\u5165\u201czn\u201d\u201czhangn\u201d\uff0c\u65e0\u6cd5\u5f97\u5230\u201c\u957f\u4e50\u5b81\u201d\u3002
                          \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1
                          \u8f93\u5165\u201cln\u201d\uff0c\u5f97\u5230\u201c\u957f\u4e50\u5b81\u201d\u3002<\/p>\n

                          \"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1<\/p>\n

                          3.\u6211\u7684\u5c0f\u5c0f\u7684\u6539\u8fdb\u5efa\u8bae<\/h3>\n

                          \u6211\u7684\u4ee3\u7801\u8fd8\u6709\u8bb8\u591a\u53ef\u6539\u8fdb\u7684\u5730\u65b9\uff0c\u5e0c\u671b\u5927\u5bb6\u591a\u591a\u6279\u8bc4\u6307\u6b63\uff01<\/code><\/p>\n

                            \n
                          1. \u63d0\u9ad8\u5c01\u88c5\u6027\uff0c\u5c06\u901a\u8baf\u5f55\u7684\u6bcf\u4e00\u4e2a\u8054\u7cfb\u4eba\u5c01\u88c5\u5305\u542bname\u548cphone\u7684\u7ed3\u6784\u4f53\uff0c\u901a\u8baf\u5f55\u4f7f\u7528\u7ed3\u6784\u4f53\u6570\u7ec4\u6216\u8005\u7ed3\u6784\u4f53\u94fe\u8868\uff0c\u52a8\u6001\u521b\u5efa\u3001\u8c03\u7528\u3001\u5b9e\u73b0\u3002<\/li>\n
                          2. \u62fc\u97f3\u5e93\u7684\u5b58\u50a8\u91c7\u7528hash\u8868\u6216\u8005\u4e00\u7ef4\u6570\u7ec4\u7684\u5b58\u50a8\u65b9\u5f0f\u4f1a\u66f4\u52a0\u8282\u7ea6\u7a7a\u95f4\uff0c\u800c\u4e14\u597d\u7528\uff0c\u591f\u7528\uff0c\u4e8c\u7ef4\u6570\u7ec4\u7684\u5b58\u50a8\u65b9\u5f0f\u6709\u4e9b\u6d6a\u8d39\u7a7a\u95f4\u3002<\/li>\n
                          3. \u591a\u97f3\u5339\u914d\u6839\u636e\u97f3\u8282\u4f7f\u7528\u9891\u7387\u4f9d\u6b21\u7ec4\u5408\uff0c\u51cf\u5c11\u9884\u5904\u7406\u7684\u65f6\u95f4\uff0c\u52a0\u5feb\u5339\u914d\u901f\u5ea6\u3002<\/li>\n<\/ol>\n
                            \n

                            \u603b\u7ed3<\/h2>\n

                            \u5e0c\u671b\u672c\u7bc7\u535a\u5ba2\u80fd\u8ba9\u5927\u5bb6\u6709\u6240\u6536\u83b7\u3002
                            \u672c\u7b97\u6cd5\u6700\u7ec8\u662f\u56e2\u961f\u6210\u679c\u7684\u5448\u73b0\uff0c\u5728\u6b64\u7279\u522b\u611f\u8c22\u94c1\u9505\u7096\u4e54\u6cbbcouple\uff0c\u9a6c\u603b\uff0cyyj-\u4e48\uff0c\u97e6\u54e5\u7684\u5927\u529b\u652f\u6301\u3002\u4ee3\u7801\u6539\u53d8\u7740\u4e16\u754c\uff0c\u6211\u4eec\u521b\u9020\u4ee3\u7801\uff0c\u4e5f\u662f\u5728\u521b\u9020\u4e16\u754c\uff0c\u8ba9\u6211\u4eec\u5728\u4ee3\u7801\u7684\u4e16\u754c\u91cc\u98ce\u96e8\u540c\u821f\uff0c\u4e00\u5f80\u65e0\u524d\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"\u3010\u6570\u636e\u7ed3\u6784\u3011\u4ee5\u4e0d\u5b8c\u6574\u62fc\u97f3\u641c\u7d22\u901a\u8baf\u5f55\u7b97\u6cd5\u8bbe\u8ba1\u672c\u6587\u4e3b\u8981\u5206\u4eab\u7b97\u6cd5\u8bbe\u8ba1\u601d\u8def\uff0c\u5176\u4e2d\u4ee3\u7801\u5747\u539f\u521b\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\u548c\u5b66\u4e60\u6587\u7ae0\u76ee\u5f55\u524d\u8a00\u4e00\u3001...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7443"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=7443"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/7443\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=7443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=7443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=7443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}