{"id":23,"date":"2024-01-25T21:52:13","date_gmt":"2024-01-25T13:52:13","guid":{"rendered":"https:\/\/www.nenuacm.top\/?p=23"},"modified":"2024-01-31T02:07:15","modified_gmt":"2024-01-30T18:07:15","slug":"23","status":"publish","type":"post","link":"https:\/\/www.nenuacm.top\/index.php\/2024\/01\/25\/23\/","title":{"rendered":"2024.1.24 \u7b80\u5355\u6a21\u62df + \u601d\u7ef4"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">A &#8211; Chocolate Thief \u5de7\u514b\u529b\u5c0f\u5077<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u6211\u7ed9\u4e86\u4e00\u4e9b\u5b66\u751f\u5de7\u514b\u529b\uff0c\u4ee5\u5956\u52b1\u4ed6\u4eec\u7684\u6770\u51fa\u8868\u73b0\u3002\u5de7\u514b\u529b\u662f\u4e00\u4e2a\u7acb\u65b9\u4f53\u5f62\u72b6\u7684\u4e1c\u897f\uff0c\u5b83\u6709\u957f\u5ea6\u3001\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u3002\u6240\u6709\u5b66\u751f\u5f97\u5230\u7684\u5de7\u514b\u529b\u6570\u91cf\u76f8\u540c\uff1b\u5b83\u4eec\u7684\u5c3a\u5bf8\u53ef\u80fd\u4e0d\u540c\uff0c\u4f46<strong>\u4f53\u79ef\u662f\u76f8\u540c<\/strong>\u7684\u3002\u73b0\u5728\uff0c\u4e00\u4e9b\u5b66\u751f\u58f0\u79f0\u4ed6\u4eec\u4e2d\u95f4\u6709\u4e00\u4e2a\u5de7\u514b\u529b\u5c0f\u5077\u3002\u56e0\u6b64\uff0c\u5bf9\u6211\u6765\u8bf4\uff0c\u627e\u51fa\u5de7\u514b\u529b\u5c0f\u5077\u5e76\u4e0d\u662f\u4e00\u4ef6\u5bb9\u6613\u7684\u4e8b\uff0c\u6240\u4ee5\u6211\u5728\u8bf7\u6c42\u4f60\u7684\u5e2e\u52a9\u3002<\/p>\n\n\n\n<p>\u4f60\u5c06\u5f97\u5230\u5b66\u751f\u7684\u540d\u5b57\u548c\u4ed6\u4eec\u5de7\u514b\u529b\u7684\u5c3a\u5bf8\uff1b\u4f60\u5fc5\u987b\u627e\u51fa\u5de7\u514b\u529b\u5c0f\u5077\u7684\u540d\u5b57\u3002\u4f60\u53ef\u4ee5\u5047\u8bbe\u6700\u591a\u53ea\u6709\u4e00\u4e2a\u5c0f\u5077\uff0c\u5982\u679c\u6709\u5c0f\u5077\u7684\u8bdd\uff0c\u4ed6\u53ea\u4ece\u53e6\u4e00\u4e2a\u5b66\u751f\uff08\u800c\u4e0d\u662f\u591a\u4e2a\u5b66\u751f\uff09\u90a3\u91cc\u62ff\u8d70\u4e86\u4e00\u90e8\u5206\u5de7\u514b\u529b\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/A\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u4e00\u4e2a\u5f88\u7b80\u5355\u7684\u6a21\u62df\uff0c\u65e2\u7136\u6b63\u5e38\u5de7\u514b\u529b\u7684\u4f53\u79ef\u90fd\u76f8\u540c\uff0c\u90a3\u6211\u4eec\u5c31\u8ba1\u7b97\u6240\u6709\u5de7\u514b\u529b\u7684\u4f53\u79ef\uff0c\u6bd4\u522b\u4eba\u5927\u7684\u90a3\u4e2a\u5c31\u662f\u5c0f\u5077\uff0c\u6bd4\u522b\u4eba\u5c0f\u7684\u90a3\u4e2a\u5c31\u662f\u88ab\u5077\u7684\u90a3\u4e2a\u3002\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u63d0\u51fa\u4e00\u79cd\u66b4\u529b\u4e00\u70b9\u7684\u601d\u8def\uff0c\u5c31\u662f\u6c42\u5e73\u5747\u503c\u4f53\u79ef\u4e4b\u540e\uff0c\u518d\u904d\u5386\u4e00\u904d\uff0c\u627e\u5230\u90a3\u4e2a\u4f53\u79ef\u5927\u7684\u548c\u90a3\u4e2a\u4f53\u79ef\u5c0f\u7684\u5c31\u884c\u3002\u5982\u679c\u6240\u6709\u4eba\u5de7\u514b\u529b\u4f53\u79ef\u90fd\u4e00\u6837\uff0c\u8bf4\u660e\u6ca1\u6709\u5c0f\u5077\uff0c\u76f4\u63a5\u8f93\u51fa\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nstruct stu{\nstring name;\n    int a,b,h;\n}s&#91;10000];\nint t,tt;\nvoid solve(){\n    int n;\n    cin &gt;&gt; n;\n    string temp1,temp2;\n    int maxx = -1,minn = 100000000,aver = 0;\n&nbsp; &nbsp;\/\/\u5faa\u73af\u4e00\u6b21\uff0c\u6c42\u5e73\u5747\u503c\uff0c\u627e\u5230\u6700\u5927\u548c\u6700\u5c0f\u7684\n    for(int i = 1;i &lt;= n;i++){\n        cin &gt;&gt; s&#91;i].name &gt;&gt; s&#91;i].a &gt;&gt; s&#91;i].b &gt;&gt; s&#91;i].h;\n        maxx = max(s&#91;i].a * s&#91;i].b * s&#91;i].h,maxx);\n        minn = min(s&#91;i].a * s&#91;i].b * s&#91;i].h,minn);\n        aver += s&#91;i].a * s&#91;i].b * s&#91;i].h;\n    }\n    aver \/= n;\n&nbsp; &nbsp;\/\/\u5982\u679c\u6700\u5927\u503c\u548c\u6700\u5c0f\u503c\u76f8\u7b49\uff0c\u8bf4\u660e\u6ca1\u6709\u5c0f\u5077\n    if(maxx == minn){\n        cout &lt;&lt; \"Case \" &lt;&lt; t - tt &lt;&lt; \": no thief\\n\";\n    }else{\n&nbsp; &nbsp;\/\/\u53d1\u73b0\u5b58\u5728\u5c0f\u5077\u4e86\u4e4b\u540e\uff0c\u8bb0\u5f55\u5c0f\u5077\u7684\u540d\u79f0\u3010\u5176\u5b9e\u4e5f\u53ef\u4ee5\u5728\u7b2c\u4e00\u6b21\u5faa\u73af\u91cc\u8bb0\u5f55\u7684\uff0c\u8fd9\u4e2a\u4f18\u5316\u4ea4\u7ed9\u8bfb\u8005\u3011\n    for(int i = 1;i &lt;= n;i++){\n        if(s&#91;i].a * s&#91;i].b * s&#91;i].h &gt; aver) {\n            temp1 = s&#91;i].name;\n        }else if(s&#91;i].a * s&#91;i].b * s&#91;i].h &lt; aver) {\n            temp2 = s&#91;i].name;\n        }\n    }\n        cout &lt;&lt; \"Case \" &lt;&lt; t - tt &lt;&lt; \": \" &lt;&lt; temp1 &lt;&lt; \" took chocolate from \" &lt;&lt; temp2 &lt;&lt; \"\\n\";\n    }\n}\nint main(){\n    cin &gt;&gt; t;\n    tt = t;\n    while(tt--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">B &#8211; Hidden Secret! \u9690\u85cf\u7684\u79d8\u5bc6<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u8fd9\u4e2a\u95ee\u9898\u4e2d\uff0c\u4f60\u9700\u8981\u5224\u65ad\u4e00\u4e2a\u540d\u5b57\u662f\u5426\u9690\u85cf\u5728\u53e6\u4e00\u4e2a\u540d\u5b57\u4e2d\u3002\u89c4\u5219\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4f60\u53ef\u4ee5\u81ea\u7531\u5730\u5c06\u4e00\u4e9b\u5927\u5199\u5b57\u6bcd\u6539\u6210\u5c0f\u5199\uff0c\u6216\u8005\u53cd\u4e4b\u3002<\/li>\n\n\n\n<li>\u4f60\u53ef\u4ee5\u81ea\u7531\u5730\u6dfb\u52a0\/\u79fb\u9664\u7a7a\u683c\u3002<\/li>\n\n\n\n<li>\u4f60\u53ef\u4ee5\u91cd\u65b0\u6392\u5217\u5b57\u6bcd\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u5982\u679c\u4e24\u4e2a\u540d\u5b57\u5b8c\u5168\u5339\u914d\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u8bf4\u4e00\u4e2a\u540d\u5b57\u9690\u85cf\u5728\u53e6\u4e00\u4e2a\u540d\u5b57\u4e2d\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/B\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u7ed9\u4f60\u4e24\u884c\u540d\u5b57\uff0c\u8ba9\u4f60\u5224\u65ad\u4e00\u884c\u540d\u5b57\u6709\u6ca1\u6709\u9690\u85cf\u5728\u53e6\u4e00\u4e2a\u540d\u5b57\u91cc\uff0c\u5e76\u4e14\u4f60\u53ef\u4ee5\u968f\u610f\u6392\u5217\u4f60\u7684\u5b57\u6bcd\u3002\u65e2\u7136\u6211\u53ef\u4ee5\u968f\u610f\u6392\u5217\u5b57\u6bcd\uff0c\u90a3\u5b57\u6bcd\u7684\u987a\u5e8f\u5c31\u4e0d\u91cd\u8981\uff0c\u6211\u4eec\u53ea\u8981\u5173\u6ce8\u8fd9\u4e00\u884c\u51fa\u73b0\u7684\u5b57\u6bcd\u662f\u5426\u80fd\u5728\u53e6\u4e00\u884c\u51fa\u73b0\u4e00\u6b21\u5c31\u884c\u4e86\u3002\u6240\u4ee5\u6211\u4eec\u53ea\u9700\u8981\u8003\u8651\u4e24\u884c\u5b57\u6bcd\u7684\u79cd\u7c7b\u548c\u5b57\u6bcd\u7684\u4e2a\u6570\u3002\u6211\u4eec\u5206\u522b\u7edf\u8ba1\u4e24\u884c\u5b57\u6bcd\u7684\u4e2a\u6570\uff0c\u5982\u679c\u4e00\u884c\u5b57\u6bcd\u7684\u4e2a\u6570\u5168\u90fd\u5927\u4e8e\u53e6\u4e00\u884c\u5b57\u6bcd\u7684\u4e2a\u6570\uff0c\u8bf4\u660e\u8fd9\u4e2a\u5b57\u6bcd\u80fd\u5728\u8fd9\u4e00\u884c\u968f\u610f\u51fa\u73b0\u3002<\/p>\n\n\n\n<p>\u6253\u4e2a\u6bd4\u65b9\uff0c\u5047\u8bbe\u7b2c\u4e00\u884c\u662faaabbb\uff0c\u7b2c\u4e8c\u884c\u662fab\uff0c\u6211\u4eec\u53d1\u73b0\u7b2c\u4e00\u884c\u7684a\u67093\u4e2a\uff0cb\u6709\u4e09\u4e2a\uff0c\u90fd\u5927\u4e8e\u7b2c\u4e8c\u884c\u7684a\u3001b\u4e2a\u6570\uff0c\u8bf4\u660e\u7b2c\u4e8c\u884c\u7684\u5b57\u6bcd\u53ef\u4ee5\u968f\u610f\u5728\u7b2c\u4e00\u884c\u51fa\u73b0\uff0c\u56e0\u4e3a\u7b2c\u4e00\u884c\u7684\u5b57\u6bcd\u662f\u201c\u591f\u7528\u201d\u7684\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\u6211\u4eec\u7684\u601d\u8def\u5c31\u662f\u6570\u8fd9\u4e24\u884c\u7684\u5b57\u6bcd\u4e2a\u6570\uff0c\u53ea\u8981\u4e00\u884c\u5404\u4e2a\u5b57\u6bcd\u4e2a\u6570\u90fd\u5927\u4e8e\u53e6\u4e00\u884c\uff0c\u5c31\u662fYes\u3002\u5426\u5219\uff0c\u5c31\u662fNo\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\n* \u8fd9\u6bb5\u4ee3\u7801\u53ea\u662f\u4e00\u79cd\u5b9e\u73b0\u65b9\u5f0f\uff0c\u540c\u6837\u7684\u601d\u8def\u53ef\u4ee5\u6709\u5f88\u591a\u4e0d\u540c\u7684\u5b9e\u73b0\u65b9\u5f0f\u7684\uff0c\u8fd9\u6bb5\u4ee3\u7801\u5176\u5b9e\u53ef\u4ee5\u4e0d\u7528\u8fd9\u4e48\u590d\u6742\uff0c\u8bfb\u8005\u53ef\u4ee5\u81ea\u884c\u4f18\u5316\n*\/\n#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nint alp&#91;1000];\nint t,tt;\nvoid solve(){\n\tstring a,b;\n\tgetline(cin,a);\n\tgetline(cin,b);\n\tint len1 = a.size();\n\tint len2 = b.size();\n\tfor(int i = 0;i &lt; 200;i++){\n\t\talp&#91;i] = 0;\n\t}\n    \/\/\u7edf\u8ba1\u7b2c\u4e00\u884c\u4e2d\u5b57\u6bcd\u8868\u5404\u4e2a\u5b57\u6bcd\u7684\u4e2a\u6570\n\tfor(int i = 0;i &lt; len1;i++){\n\t\tif(a&#91;i] &gt;= 'a' &amp;&amp; a&#91;i] &lt;= 'z'){\n\t\t\talp&#91;a&#91;i] - 'a']++;\n\t\t}\n\t\tif(a&#91;i] &gt;= 'A' &amp;&amp; a&#91;i] &lt;= 'Z'){\n\t\t\talp&#91;a&#91;i] - 'A']++;\n\t\t}\n\t}\n    \/\/\u51cf\u53bb\u7b2c\u4e8c\u884c\u4e2d\u5b57\u6bcd\u8868\u5404\u4e2a\u5b57\u6bcd\u7684\u4e2a\u6570\n\tfor(int i = 0;i &lt; len2;i++){\n\t\tif(b&#91;i] &gt;= 'a' &amp;&amp; b&#91;i] &lt;= 'z'){\n\t\t\talp&#91;b&#91;i] - 'a']--;\n\t\t}\n\t\tif(b&#91;i] &gt;= 'A' &amp;&amp; b&#91;i] &lt;= 'Z'){\n\t\t\talp&#91;b&#91;i] - 'A']--;\n\t\t}\n\t}\n\tint flag1 = 0;\n\tfor(int i = 0;i &lt; 26;i++){\n\t\tif(alp&#91;i] &lt; 0){\n\t\t\tflag1 = 1;\n\t\t}\n\t}\n    \/\/\u6ca1\u6709\u8d1f\u7684\uff0c\u8bf4\u660e\u7b2c\u4e00\u884c\u7684\u5b57\u6bcd\u4e2a\u6570\u6bd4\u7b2c\u4e8c\u884c\u90fd\u591a\n\tif(flag1 == 0){\n\t\tcout &lt;&lt; \"Case \" &lt;&lt; t - tt &lt;&lt; \": Yes\" &lt;&lt; \"\\n\";\n\t\treturn;\n\t}\n\tflag1 = 0;\n\tfor(int i = 0;i &lt; 26;i++){\n\t\tif(alp&#91;i] &gt; 0){\n\t\t\tflag1 = 1;\n\t\t}\n\t}\n    \/\/\u6ca1\u6709\u6b63\u7684\uff0c\u8bf4\u660e\u7b2c\u4e8c\u884c\u7684\u5b57\u6bcd\u4e2a\u6570\u6bd4\u7b2c\u4e00\u884c\u90fd\u591a\n\tif(flag1 == 0){\n\t\tcout &lt;&lt; \"Case \" &lt;&lt; t - tt &lt;&lt; \": Yes\" &lt;&lt; \"\\n\";\n\t\treturn;\n\t}\n    \/\/\u5426\u5219\uff0c\u5c31\u8f93\u51faNo\n\tcout &lt;&lt; \"Case \" &lt;&lt; t - tt &lt;&lt; \": No\" &lt;&lt; \"\\n\";\n}\nint main(){\n\tcin &gt;&gt; t;\n\ttt = t;\n\tcin.ignore();\n\twhile(tt--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">C &#8211; Scarecrow \u7a3b\u8349\u4eba<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u5854\u7d22\u62e5\u6709\u4e00\u7247\u975e\u5e38\u957f\u7684\u7530\u5730\u3002\u4ed6\u8ba1\u5212\u5728\u5373\u5c06\u5230\u6765\u7684\u79cd\u690d\u5b63\u8282\u79cd\u690d\u4e0d\u540c\u7c7b\u578b\u7684\u4f5c\u7269\u3002\u7136\u800c\uff0c\u8fd9\u7247\u533a\u57df\u5230\u5904\u90fd\u662f\u4e4c\u9e26\uff0c\u5854\u7d22\u62c5\u5fc3\u5b83\u4eec\u53ef\u80fd\u4f1a\u5403\u6389\u5927\u90e8\u5206\u4f5c\u7269\u3002\u56e0\u6b64\uff0c\u4ed6\u51b3\u5b9a\u5728\u7530\u5730\u7684\u4e0d\u540c\u4f4d\u7f6e\u653e\u7f6e\u4e00\u4e9b\u7a3b\u8349\u4eba\u3002<\/p>\n\n\n\n<p>\u8fd9\u7247\u7530\u5730\u53ef\u4ee5\u88ab\u5efa\u6a21\u4e3a 1 x N \u7684\u7f51\u683c\u3002\u7530\u5730\u7684\u4e00\u4e9b\u90e8\u5206\u662f\u4e0d\u80b2\u7684\uff0c\u8fd9\u610f\u5473\u7740\u4f60\u4e0d\u80fd\u5728\u4e0a\u9762\u79cd\u690d\u4efb\u4f55\u4f5c\u7269\u3002\u5f53\u7a3b\u8349\u4eba\u653e\u7f6e\u5728\u4e00\u4e2a\u4f4d\u7f6e\u65f6\uff0c\u5b83\u4f1a\u8986\u76d6\u5b83\u6240\u5728\u7684\u5355\u5143\u683c\u4ee5\u53ca\u5176\u5de6\u53f3\u7d27\u90bb\u7684\u5355\u5143\u683c\u3002\u6839\u636e\u7530\u5730\u7684\u63cf\u8ff0\uff0c\u9700\u8981\u653e\u7f6e\u6700\u5c11\u6570\u91cf\u7684\u7a3b\u8349\u4eba\u6765\u8986\u76d6\u6240\u6709\u6709\u7528\u7684\u7530\u5730\u90e8\u5206\u5417\uff1f\u6709\u7528\u7684\u90e8\u5206\u6307\u7684\u662f\u53ef\u4ee5\u79cd\u690d\u4f5c\u7269\u7684\u5355\u5143\u683c\u3002<\/p>\n\n\n\n<p>\u8f93\u5165\u4ee5\u4e00\u4e2a\u6574\u6570 T\uff08\u2264 50\uff09\u5f00\u59cb\uff0c\u8868\u793a\u6d4b\u8bd5\u7528\u4f8b\u7684\u6570\u91cf\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6848\u4f8b\u4ee5\u4e00\u4e2a\u5305\u542b\u6574\u6570 N\uff080 &lt; N &lt; 100\uff09\u7684\u884c\u5f00\u59cb\u3002\u4e0b\u4e00\u884c\u5305\u542b N \u4e2a\u5b57\u7b26\u6765\u63cf\u8ff0\u7530\u5730\u3002\u70b9\u53f7 . \u8868\u793a\u53ef\u4ee5\u79cd\u690d\u4f5c\u7269\u7684\u5730\u65b9\uff0c\u4e95\u53f7 # \u8868\u793a\u4e0d\u80b2\u7684\u533a\u57df\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/C\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u5176\u5b9e\u5c31\u662f\u95ee\u4f60\u4e00\u884c\u7530\u5730\uff0c\u8981\u653e\u51e0\u4e2a\u7a3b\u8349\u4eba\u8986\u76d6\u6709\u7528\u7684\u7530\u5730\u3002\u4e00\u4e2a\u7a3b\u8349\u4eba\u80fd\u8986\u76d6\u4e09\u4e2a\u4f4d\u7f6e\uff0c\u7136\u540e\u95ee\u4f60\u9700\u8981\u6709\u51e0\u4e2a\u7a3b\u8349\u4eba\u3002\u8fd9\u9898\u5728\u8111\u6d77\u4e2d\u6a21\u62df\u4e00\u4e0b\uff0c\u5176\u5b9e\u5c31\u662f\u6bcf\u4e2a . \u90fd\u9700\u8981\u7a3b\u8349\u4eba\uff0c\u65e2\u7136\u9700\u8981\u6700\u5c11\u7684\uff0c\u6211\u4eec\u5c31\u4ece\u5de6\u5f80\u53f3\u4e00\u70b9\u70b9\u60f3\u3002\u6211\u4eec\u53ef\u4ee5\u91c7\u7528<strong>\u8d2a\u5fc3<\/strong>\u7684\u7b56\u7565\uff0c\u6bcf\u6b21\u9047\u5230\u4e00\u4e2a . \u4e4b\u540e\uff0c\u6211\u4eec\u77e5\u9053\u8fd9\u4e2a\u70b9\u9700\u8981\u88ab\u7a3b\u8349\u4eba\u4fdd\u62a4\uff0c\u6240\u4ee5\u7a3b\u8349\u4eba\u6570\u91cf+1\uff0c\u7136\u540e\u6211\u4eec\u8dd1\u5230\u4e09\u683c\u4e4b\u540e\u7ee7\u7eed\u8003\u8651\u3002\u56e0\u4e3a\u6211\u4eec\u77e5\u9053\u90a3\u4e2a . \u5fc5\u987b\u88ab\u7a3b\u8349\u4eba\u4fdd\u62a4\uff0c\u6240\u4ee5\u90a3\u4e2a\u7a3b\u8349\u4eba\u662f\u5fc5\u987b\u7684\uff0c\u65e2\u7136\u4e00\u5b9a\u4f1a\u653e\u4e00\u4e2a\u7a3b\u8349\u4eba\u5728\u8fd9\uff0c\u90a3\u7a3b\u8349\u4eba\u4fdd\u62a4\u8303\u56f4\u5185\u7684\u683c\u5b50\u5230\u5e95\u662f\u4ec0\u4e48\u8fd9\u4ef6\u4e8b\uff0c\u6211\u4eec\u6839\u672c\u4e0d\u9700\u8981\u8003\u8651\uff0c\u56e0\u4e3a\u8fd9\u91cc\u4e00\u5b9a\u4f1a\u653e\u7f6e\u4e00\u4e2a\u7a3b\u8349\u4eba\u3002\u6211\u4eec\u53ea\u9700\u8981\u8dd1\u5230\u4e09\u683c\u4e4b\u540e\u7ee7\u7eed\u4e4b\u524d\u7684\u6b65\u9aa4\u5c31\u884c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nint t,tt;\nvoid solve(){\n\tint n;\n\tcin &gt;&gt; n;\n\tstring s;\n\tcin &gt;&gt; s;\n\tint count = 0;\n\tfor(int i = 0;i &lt; n;i++){\n\t\tif(s&#91;i] == '.'){\n\t\t\tcount++;\n\t\t\ti += 2;\n\t\t}\n\t}\n\tcout &lt;&lt; \"Case \" &lt;&lt; t - tt &lt;&lt; \": \" &lt;&lt; count &lt;&lt; \"\\n\";\n}\nint main(){\n\tcin &gt;&gt; t;\n\ttt = t;\n\twhile(tt--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">D &#8211; Again Array Queries \u518d\u6b21\u6570\u7ec4\u67e5\u8be2<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u5305\u542b n \u4e2a\u6574\u6570\u7684\u6570\u7ec4\uff0c\u540c\u65f6\u7ed9\u5b9a\u6570\u7ec4\u4e2d\u7684\u4e24\u4e2a\u7d22\u5f15 i \u548c j\uff08i \u2260 j\uff09\u3002\u4f60\u9700\u8981\u627e\u5230\u8be5\u8303\u56f4\u5185\u4e24\u4e2a\u6574\u6570\uff0c\u4f7f\u5b83\u4eec\u7684\u5dee\u503c\u6700\u5c0f\u3002\u6570\u7ec4\u7684\u7d22\u5f15\u4ece 0 \u5230 n-1\u3002<\/p>\n\n\n\n<p>\u8f93\u5165\u4ee5\u4e00\u4e2a\u6574\u6570 T\uff08T \u2264 5\uff09\u5f00\u59cb\uff0c\u8868\u793a\u6d4b\u8bd5\u7528\u4f8b\u7684\u6570\u91cf\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u5305\u542b\u4e24\u4e2a\u6574\u6570 n\uff082 \u2264 n \u2264 10^5\uff09\u548c q\uff081 \u2264 q \u2264 10000\uff09\u3002\u4e0b\u4e00\u884c\u5305\u542b n \u4e2a\u7528\u7a7a\u683c\u5206\u9694\u7684\u6574\u6570\uff0c\u8fd9\u4e9b\u6574\u6570\u6784\u6210\u4e86\u6570\u7ec4\u3002<strong>\u8fd9\u4e9b\u6574\u6570\u7684\u53d6\u503c\u8303\u56f4\u5728 [1, 1000] \u4e4b\u95f4\u3002<\/strong><\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u7684 q \u884c\uff0c\u6bcf\u884c\u5305\u542b\u4e24\u4e2a\u6574\u6570 i \u548c j\uff080 \u2264 i &lt; j &lt; n\uff09\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/D\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u8fd9\u9898\u9898\u610f\u90fd\u80fd\u7406\u89e3\uff0c\u4f46\u662f\u601d\u8def\u4e0d\u592a\u5bb9\u6613\u60f3\u5230\u3002\u6211\u4eec\u5c31\u662f\u60f3\u77e5\u9053\u8bf4\u5728 i \u548c j \u4e4b\u95f4\u6700\u5c0f\u7684\u5dee\u503c\u662f\u591a\u5c11\u3002\u5176\u5b9e\u5c31\u662f\u6211\u4eec\u53ef\u4ee5\u628a\u7b2c i \u4e2a\u5230\u7b2c j \u4e2a\u4e4b\u95f4\u7684\u6570\u7ec4\u6392\u4e2a\u5e8f\uff0c\u7136\u540e\u770b\u770b\u54ea\u4e00\u6bb5\u95f4\u8ddd\u6700\u5c0f\u3010\u56e0\u4e3a\u5dee\u503c\u4e00\u5b9a\u662f\u6700\u8fd1\u7684\u4e24\u4e2a\u6570\u5b57\u4e4b\u95f4\u7684\u5dee\u503c\u3011\u3002\u4f46\u662f\u6211\u4eec\u505a\u4e0d\u523010000\u6b21\u8be2\u95ee\u91cc\uff0c\u6bcf\u6b21\u90fd\u628a i \u5230 j \u4e4b\u95f4\u7684\u90a3\u90e8\u5206\u6570\u7ec4\u90fd\u6392\u5e8f\u4e00\u6b21\uff0c\u56e0\u4e3a\u8fd9\u6837 n * nlogn \u7684\u6781\u9650\u60c5\u51b5\u662f\u4e00\u5b9a\u4f1a\u8d85\u65f6\u7684\u3010\u7b14\u8005\u5c1d\u8bd5\u4e86\u597d\u51e0\u6b21\u3011\u3002\u8fd9\u9898\u7684\u7a81\u7834\u70b9\u5728\u4e8e\uff0c\u6240\u6709\u6574\u6570\u7684\u53d6\u503c\u8303\u56f4\u662f\u6709\u9650\u7684\uff0c\u53ea\u6709[1, 1000]\u7684\u6570\u636e\u8303\u56f4\u3002\u6211\u4eec\u53ef\u4ee5\u904d\u5386\u4e00\u904d\u8fd9\u4e2a\u8303\u56f4\uff0c\u770b\u770b\u4ece i \u5230 j \u91cc\u51fa\u73b0\u8fc7\u7684\u90a3\u4e9b\u6570\u5b57\u90fd\u5728\u54ea\u3002\u5047\u8bbe\u4e00\u4e2a\u6570\u5b57\u51fa\u73b0\u4e24\u6b21\uff0c\u8bf4\u660e\u5b58\u5728\u6700\u5c0f\u5dee\u503c0\u3002\u5047\u8bbe\u6240\u6709\u6570\u5b57\u90fd\u53ea\u51fa\u73b0\u4e00\u6b21\uff0c\u90a3\u6211\u5c31\u770b\u4e0a\u4e00\u6b21\u51fa\u73b0\u7684\u6570\u5b57\u548c\u8fd9\u4e00\u6b21\u51fa\u73b0\u7684\u6570\u5b57\u4e4b\u95f4\u7684\u5dee\u503c\u662f\u591a\u5c11\u3002\u6700\u540e\u4ece\u5934\u8d70\u5230\u5c3e\u4e00\u904d\uff0c\u53d6\u5dee\u503c\u7684\u6700\u5c0f\u503c\u5c31\u597d\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nint t,tt;\nint a&#91;100007];\nint cnt&#91;1007];\n\nvoid solve(){\n\tcout &lt;&lt; \"Case \" &lt;&lt; t - tt &lt;&lt; \":\" &lt;&lt; \"\\n\";\n\tint n,q;\n\tcin &gt;&gt; n &gt;&gt; q;\n\t\n\tfor(int i = 0;i &lt; n;i++){\n\t\tcin &gt;&gt; a&#91;i];\n\t}\n\tfor(int i = 1;i &lt;= q;i++){\n\t\tint l,r;\n\t\tcin &gt;&gt; l &gt;&gt; r;\n\t\tmemset(cnt,0,sizeof(cnt));\n\t\tfor(int j = l;j &lt;= r;j++){\n\t\t\tcnt&#91;a&#91;j]]++;\n\t\t}\n\t\tint ans = 0x3f3f3f3f;\n\t\tint pre = -ans;\n\t\n\t\tfor(int j = 1;j &lt;= 1000;j++){\n\t\t\t\/\/\u6ca1\u51fa\u73b0\u8fc7\u7684\u6570\u5b57\u5c31\u8df3\u8fc7\n\t\t\tif(cnt&#91;j] == 0){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\/\/\u8bf4\u660e\u6709\u6570\u5b57\u91cd\u590d\u51fa\u73b0\n\t\t\tif(cnt&#91;j] &gt;= 2){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans = min(ans,j - pre);\n\t\t\t\/\/pre\u5b58\u50a8\u4e0a\u4e00\u6b21\u51fa\u73b0\u8fc7\u7684\u6570\u5b57\n\t\t\tpre = j;\n\t\t}\n\t\tcout &lt;&lt; ans &lt;&lt; \"\\n\";\n\t}\n}\nint main(){\n\tcin &gt;&gt; t;\n\ttt = t;\n\twhile(tt--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">E &#8211; Scenes From a Memory \u8bb0\u5fc6\u573a\u666f<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u5728\u50ac\u7720\u4f1a\u8bae\u671f\u95f4\uff0c\u5c3c\u53e4\u62c9\u65af\u7a81\u7136\u8bb0\u8d77\u4e86\u4e00\u4e2a\u6b63\u6574\u6570 n\uff0c\u8fd9\u4e2a\u6570\u5728\u5341\u8fdb\u5236\u8868\u793a\u4e2d\u4e0d\u5305\u542b\u96f6\u3002<\/p>\n\n\n\n<p>\u4e0d\u4e45\uff0c\u5f53\u4ed6\u56de\u5230\u5bb6\u65f6\uff0c\u4ed6\u53d8\u5f97\u597d\u5947\uff1a\u53ef\u4ee5\u4ece\u8fd9\u4e2a\u6570\u4e2d\u79fb\u9664\u6700\u591a\u591a\u5c11\u4f4d\u6570\u5b57\uff0c\u4f7f\u5f97\u8fd9\u4e2a\u6570\u53d8\u6210\u975e\u8d28\u6570\uff0c\u4e5f\u5c31\u662f\u53d8\u6210\u5408\u6570\u6216\u8005\u7b49\u4e8e\u4e00\uff1f<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u67d0\u4e9b\u6570\u5b57\u6765\u8bf4\uff0c\u8fd9\u662f\u4e0d\u53ef\u80fd\u7684\uff1a\u4f8b\u5982\uff0c\u5bf9\u4e8e\u6570\u5b57 53\uff0c\u4e0d\u53ef\u80fd\u901a\u8fc7\u5220\u9664\u90e8\u5206\u6570\u5b57\u6765\u5f97\u5230\u4e00\u4e2a\u975e\u8d28\u6570\u7684\u6574\u6570\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u672c\u95ee\u9898\u6d4b\u8bd5\u7528\u4f8b\u4e2d\u7684\u6240\u6709 n\uff0c\u4fdd\u8bc1\u53ef\u4ee5\u901a\u8fc7\u5220\u9664\u90e8\u5206\u6570\u5b57\u6765\u5f97\u5230\u4e00\u4e2a\u975e\u8d28\u6570\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u5220\u9664\u6570\u4e2d\u7684\u6240\u6709\u6570\u5b57\u3002<\/p>\n\n\n\n<p>\u8d28\u6570\u662f\u9664\u4e86\u4e00\u548c\u5176\u672c\u8eab\u5916\u6ca1\u6709\u5176\u4ed6\u56e0\u6570\u7684\u6570\u3002\u5408\u6570\u662f\u6709\u4e24\u4e2a\u4ee5\u4e0a\u56e0\u6570\u7684\u6570\u30021 \u65e2\u4e0d\u662f\u8d28\u6570\u4e5f\u4e0d\u662f\u5408\u6570\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u5305\u542b\u591a\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u6b63\u6574\u6570 t\uff081\u2264t\u226410^3\uff09\uff0c\u8868\u793a\u6d4b\u8bd5\u7528\u4f8b\u7684\u6570\u91cf\u3002\u6d4b\u8bd5\u7528\u4f8b\u7684\u63cf\u8ff0\u5982\u4e0b\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u7684\u7b2c\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u6b63\u6574\u6570 k\uff081\u2264k\u226450\uff09\u2014\u2014\u6570\u5b57\u7684\u4f4d\u6570\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u7684\u7b2c\u4e8c\u884c\u5305\u542b\u4e00\u4e2a\u6b63\u6574\u6570 n\uff0c\u5728\u5341\u8fdb\u5236\u8868\u793a\u4e2d\u4e0d\u5305\u542b\u96f6\uff0810^(k\u22121)\u2264n&lt;10^k\uff09\u3002\u4fdd\u8bc1\u603b\u662f\u53ef\u4ee5\u901a\u8fc7\u5220\u9664\u5c11\u4e8e k \u4f4d\u6570\u5b57\u4f7f\u5f97\u6570\u53d8\u6210\u975e\u8d28\u6570\u3002<\/p>\n\n\n\n<p>\u4fdd\u8bc1\u6240\u6709\u6d4b\u8bd5\u7528\u4f8b\u4e2d k \u7684\u603b\u548c\u4e0d\u8d85\u8fc7 10^4\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\uff0c\u4f60\u9700\u8981\u6253\u5370\u4e24\u884c\u6570\u5b57\u3002\u5728\u7b2c\u4e00\u884c\u6253\u5370\u4f60\u5728\u6570\u5b57\u4e2d\u4fdd\u7559\u7684\u4f4d\u6570\u3002\u5728\u7b2c\u4e8c\u884c\u6253\u5370\u6240\u6709\u5220\u9664\u540e\u7559\u4e0b\u7684\u6570\u5b57\u3002<\/p>\n\n\n\n<p><em><strong><u>\u5728\u5b58\u5728\u591a\u4e2a\u89e3\u51b3\u65b9\u6848\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u9009\u62e9\u6253\u5370\u4efb\u4f55\u4e00\u4e2a\u3002<\/u><\/strong><\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/E\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u7b80\u5355\u6765\u8bf4\uff0c\u5c31\u662f\u7ed9\u4f60\u4e00\u4e2a\u5f88\u5927\u5f88\u5927\u7684\u6570\u5b57\uff0c\u7136\u540e\u5220\u6389\u4efb\u610f\u51e0\u4f4d\uff0c\u8ba9\u8fd9\u4e2a\u6570\u5b57\u53d8\u6210\u4e00\u4e2a\u5408\u6570\u6216\u80051\uff0c\u600e\u4e48\u5220\u4e0d\u91cd\u8981\uff0c\u53cd\u6b63\u6700\u540e\u5f97\u5230\u7684\u6570\u5b57\u6ee1\u8db3\u6761\u4ef6\u5c31\u884c\u4e86\u3002\u7136\u540e\u56e0\u4e3a\u8fd9\u4e2a\u6570\u5b57\u53ef\u80fd\u5f88\u5927\u5f88\u5927\uff0c\u6240\u4ee5\u6211\u4eec\u7528\u5b57\u7b26\u4e32\u6765\u5904\u7406\u3002\u5982\u679c\u5b57\u7b26\u4e32\u4e2d\u5305\u542b1\u6216\u80054\u6216\u80056\u6216\u80058\u6216\u80059\uff0c\u6211\u4eec\u5c31\u53ea\u4fdd\u7559\u8be5\u6570\u5b57\uff0c\u5176\u5b83\u5168\u90e8\u5220\u6389\u5c31\u597d\u4e86\uff1b\u5982\u679c\u53ea\u5305\u542b2\u6216\u80053\u6216\u80055\u6216\u80057\uff0c\u6211\u4eec\u5c31\u627e\u4ed6\u4eec\u53ef\u80fd\u51d1\u6210\u7684\u6240\u6709\u4e24\u4f4d\u6570\u5c31\u53ef\u4ee5\u4e86\u3002\u6240\u6709\u5bf9\u4e8e\u7b2c\u4e8c\u79cd\u60c5\u51b5\uff0c\u6211\u4eec\u66b4\u529b\u904d\u5386\u5b57\u7b26\u4e32\u91cc\u6240\u6709\u53ef\u80fd\u7ec4\u6210\u7684\u4e24\u4f4d\u6570\uff0c\u5982\u679c\u54ea\u4e2a\u4e24\u4f4d\u6570\u662f\u5408\u6570\uff0c\u6211\u4eec\u5c31\u76f4\u63a5\u8f93\u51fa\uff0c\u7136\u540e\u7ed3\u675f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nint t,tt;\nint cnt&#91;100];\nbool _is(int n){\n\tint flag = 0;\n\tfor(int i = 2;i &lt;= sqrt(n);i++){\n\t\t\/\/\u4e0d\u662f\u7d20\u6570\n\t\tif(n % i == 0){\n\t\t\tflag = 1;\n\t\t}\n\t}\n\tif(flag) return false;\n\treturn true;\n}\nvoid solve(){\n\tmemset(cnt,0,sizeof(cnt));\n\tstring n;\n\tint k;\n\tcin &gt;&gt; k;\n\tcin &gt;&gt; n;\n\tfor(int i = 0;i &lt; k;i++){\n\t\tint temp = n&#91;i] - '0';\n\t\tcnt&#91;temp]++;\n\t\tif(temp == 1 || temp == 4 || temp == 6 || temp == 8 || temp == 9){\n\t\t\tcout &lt;&lt; 1 &lt;&lt; \"\\n\" &lt;&lt; temp &lt;&lt; \"\\n\";\n\t\t\treturn;\n\t\t}\n\t}\n\t\/\/2 3 5 7\u7684\u60c5\u51b5\n\tcout &lt;&lt; 2 &lt;&lt; \"\\n\";\n\tfor(int i = 0;i &lt; k;i++){\n\t\tfor(int j = i + 1;j &lt; k;j++){\n\t\t\tint num = (n&#91;i] - '0') * 10 + n&#91;j] - '0';\n\t\t\tif(!_is(num)){\n\t\t\t\tcout &lt;&lt; num &lt;&lt; \"\\n\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\t\n}\nint main(){\n\tcin &gt;&gt; t;\n\ttt = t;\n\twhile(tt--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">F &#8211; Maximum Product \u6700\u5927\u4e58\u79ef<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u6574\u6570\u6570\u7ec4\uff0c\u627e\u51fa\u6240\u6709\u4e94\u4e2a\u7d22\u5f15 (i, j, k, l, t)\uff08i &lt; j &lt; k &lt; l &lt; t\uff09\u4e2d a_i \u00d7 a_j \u00d7 a_k \u00d7 a_l \u00d7 a_t \u7684<strong>\u6700\u5927<\/strong>\u53ef\u80fd\u503c\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/F\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u6b63\u53cd\u6392\u5e8f\u6570\u7ec4\uff0c\u6570\u7ec4a\u4ece\u5c0f\u5230\u5927\uff0c\u6570\u7ec4b\u4ece\u5927\u5230\u5c0f\uff0c\u7136\u540e\u4ece\u6570\u7ec4a\u4e2d\u9009\u53d6 0 ~ 5 \u4e2a\uff0c\u4ece\u6570\u7ec4b\u4e2d\u9009\u53d6 5 &#8211; i \u4e2a\u3010 i \u8868\u793a\u4ece\u6570\u7ec4a\u4e2d\u9009\u53d6\u7684\u4e2a\u6570\u3011\uff0c\u8fd9\u6837\u5c31\u662f\u6b63\u7684\u548c\u8d1f\u7684\u90fd\u6709\u53ef\u80fd\u88ab\u9009\u4e2d\u3002\u7136\u540e\u628a\u9009\u4e2d\u7684\u8fd9\u4e9b\u6570\u5b57\u76f8\u4e58\uff0c\u679a\u4e3e\u6240\u6709\u53ef\u80fd\uff0c\u53d6\u6700\u5927\u503c\uff0c\u5c31\u80fd\u5f97\u5230\u7ed3\u679c\u3002<\/p>\n\n\n\n<p>\u8fd9\u9898\u7684\u601d\u8def\u53ef\u80fd\u6bd4\u8f83\u96be\u60f3\u5230\uff0c\u4f46\u662f\u5176\u5b9e\u4ed4\u7ec6\u60f3\u4e00\u60f3\uff0c\u8fd9\u662f\u663e\u800c\u6613\u89c1\u7684\uff0c\u56e0\u4e3a\u6700\u5927\u4e58\u79ef\u7684\u56e0\u5b50\uff0c\u4e00\u5b9a\u662f\u7531\u6700\u5927\u7684\u8fd9\u51e0\u4e2a\u6b63\u6570\u548c\u7edd\u5bf9\u503c\u6700\u5927\u7684\u8fd9\u51e0\u4e2a\u8d1f\u6570\u7ec4\u6210\u3002<\/p>\n\n\n\n<p>\u8fd9\u9898\u6570\u636e\u8303\u56f4\u4f1a\u8d85\u8fc7 int \uff0c\u6240\u6709\u9700\u8981\u5f00 long long \u9632\u6b62\u6ea2\u51fa\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\ntypedef long long ll;\nconst ll INF = 0x3f3f3f3f3f3f3f3f;\nint a&#91;100007];\nint b&#91;100007];\nbool cmp(int a,int b){\n\treturn a &gt; b;\n}\nvoid solve(){\n\tint n;\n\tcin &gt;&gt; n;\n\tfor(int i = 1;i &lt;= n;i++){\n\t\tcin &gt;&gt; a&#91;i];\n\t\tb&#91;i] = a&#91;i];\n\t}\n\tsort(a + 1,a + n + 1);\n\tsort(b + 1,b + n + 1,cmp);\n\tll ans = -INF;\n\tfor(int i = 0;i &lt;= 5;i++){\n\t\tint j = 5 - i;\n\t\tll sum = 1;\n        \/\/\u53d6\u6700\u5927\u7684\u51e0\u4e2a\u6b63\u6570\n\t\tfor(int k = 1;k &lt;= i;k++){\n\t\t\tsum *= a&#91;k];\n\t\t}\n        \/\/\u53d6\u7edd\u5bf9\u503c\u6700\u5927\u7684\u51e0\u4e2a\u8d1f\u6570\n\t\tfor(int k = 1;k &lt;= j;k++){\n\t\t\tsum *= b&#91;k];\n\t\t}\n\t\tans = max(ans,sum);\n\t}\n\tcout &lt;&lt; ans &lt;&lt; \"\\n\";\n}\nint main(){\n\tint t;\n\tcin &gt;&gt; t;\n\twhile(t--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">G &#8211; Sifid and Strange Subsequences &#8220;Sifid\u548c\u5947\u602a\u7684\u5b50\u5e8f\u5217&#8221;<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u4e00\u4e2a\u5e8f\u5217 (b1,b2,\u2026,bk) \u88ab\u79f0\u4e3a\u5947\u602a\u7684\uff0c\u5982\u679c\u5176\u4efb\u4f55\u4e00\u5bf9\u5143\u7d20\u4e4b\u95f4\u7684\u7edd\u5bf9\u5dee\u503c\u5927\u4e8e\u6216\u7b49\u4e8e\u5e8f\u5217\u4e2d\u7684\u6700\u5927\u5143\u7d20\u3002\u5f62\u5f0f\u4e0a\u6765\u8bf4\uff0c\u5982\u679c\u5bf9\u4e8e\u6240\u6709 1\u2264i&lt;j\u2264k \u7684 (i,j) \u5bf9\uff0c\u6211\u4eec\u6709 |ai\u2212aj|\u2265MAX\uff0c\u5176\u4e2d MAX \u662f\u5e8f\u5217\u4e2d\u7684\u6700\u5927\u5143\u7d20\uff0c\u5219\u5b83\u662f\u5947\u602a\u7684\u3002<\/p>\n\n\n\n<p>\u7279\u522b\u662f\uff0c\u4efb\u4f55\u957f\u5ea6\u81f3\u591a\u4e3a 1 \u7684\u5e8f\u5217\u90fd\u662f\u5947\u602a\u7684\u3002 \u4f8b\u5982\uff0c\u5e8f\u5217 (-2021,\u22121,\u22121,\u22121) \u548c (-1,0,1) \u662f\u5947\u602a\u7684\uff0c\u4f46 (3,0,1) \u4e0d\u662f\uff0c\u56e0\u4e3a |0\u22121|&lt;3\u3002<\/p>\n\n\n\n<p>Sifid \u6709\u4e00\u4e2a\u6574\u6570\u6570\u7ec4 a\u3002Sifid \u559c\u6b22\u6240\u6709\u5927\u7684\u4e1c\u897f\uff0c\u56e0\u6b64\u5728 a \u7684\u6240\u6709\u5947\u602a\u5b50\u5e8f\u5217\u4e2d\uff0c\u4ed6\u60f3\u627e\u5230\u6700\u957f\u7684\u5b50\u5e8f\u5217\u7684\u957f\u5ea6\u3002\u4f60\u80fd\u5e2e\u5e2e\u4ed6\u5417\uff1f\u5e8f\u5217 c \u662f\u6570\u7ec4 d \u7684\u5b50\u5e8f\u5217\uff0c\u5982\u679c c \u53ef\u4ee5\u901a\u8fc7\u5220\u9664\u51e0\u4e2a\uff08\u53ef\u80fd\u4e3a\u96f6\u6216\u5168\u90e8\uff09\u5143\u7d20\u4ece d \u83b7\u5f97\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/G\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u5bf9\u4e8e\u8fd9\u79cd\u601d\u7ef4\u9898\uff0c\u6211\u4eec\u5176\u5b9e\u53ef\u4ee5\u6765\u601d\u8003<strong>\u9898\u76ee\u7684\u5b9a\u4e49\u672c\u8eab<\/strong>\u53ef\u4ee5\u600e\u4e48\u88ab\u8868\u8ff0\u3002\u9898\u76ee\u662f\u8ba9\u6211\u4eec\u627e\u6700\u957f\u7684\u5947\u602a\u5b50\u5e8f\u5217\uff0c\u8fd9\u4e2a\u5e8f\u5217\u7684\u7279\u70b9\u5c31\u662f\u5176\u4e2d\u4efb\u610f\u6570\u4e4b\u5dee\u7684\u7edd\u5bf9\u503c\u8981\u5927\u4e8e\u8fd9\u4e24\u4e2a\u6570\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u628a\u73a9\u4e00\u4e0b\u6837\u4f8b\uff0c\u5206\u7c7b\u8ba8\u8bba\u4e00\u4e0b\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u5e8f\u5217\u5168\u662f\u8d1f\u6570\u7684\u60c5\u51b5\uff0c\u4e00\u5b9a\u662f\u6ee1\u8db3\u7684\uff0c\u6bd5\u7adf\u6240\u6709\u7684\u7edd\u5bf9\u503c\u4e00\u5b9a\u90fd\u6bd4\u8d1f\u6570\u5927\u3002<\/p>\n\n\n\n<p>\u5047\u8bbe\u5e8f\u5217\u6709\u5927\u4e8e\u6216\u7b49\u4e8e\u4e24\u4e2a\u6b63\u6570\uff0c\u6211\u4eec\u4f1a\u53d1\u73b0\uff0c\u8fd9\u4e24\u4e2a\u6570\u7684\u5dee\u7684\u7edd\u5bf9\u503c\u4e00\u5b9a\u4f1a\u5c0f\u4e8e\u8fd9\u4e24\u4e2a\u6570\uff0c\u6240\u4ee5\u8fd9\u4e2a\u5e8f\u5217\u4e00\u5b9a\u4e0d\u5947\u602a\u3002<\/p>\n\n\n\n<p>\u5047\u8bbe\u5e8f\u5217\u91cc\u5c31\u4e00\u4e2a\u6b63\u6570\uff0c\u5c31\u6bd4\u8f83\u590d\u6742\u4e86\uff0c\u6bd4\u5982\uff08-1\uff0c0\uff0c2\uff09\u8fd9\u4e2a\u5e8f\u5217\u5c31\u4e0d\u662f\u4e2a\u5947\u602a\u5e8f\u5217\uff0c\u56e0\u4e3a|-1 &#8211; 0| = 1 \uff1c 2\uff0c\u6240\u4ee5\u8fd9\u4e2a\u6b63\u6570\u9009\u8fd8\u662f\u4e0d\u9009\uff0c\u53d6\u51b3\u4e8e\u975e\u6b63\u6570\u4eec\u7684\u6700\u5c0f\u5dee\u503c\u662f\u5426\u5927\u4e8e\u7b49\u4e8e\u8fd9\u4e2a\u6b63\u6570\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u627e\u5230\u6700\u5c0f\u7684\u6b63\u6570\u505a\u7279\u5224\u5c31\u597d\u4e86\u3002<\/p>\n\n\n\n<p>\u603b\u7ed3\u5b8c\u4e86\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6211\u4eec\u8981\u7684\u6700\u957f\u5e8f\u5217\u7684\u7ec4\u6210\u5c31\u662f\u6240\u6709\u8d1f\u6570 + \u6240\u6709\u76840 + \u7279\u522b\u5224\u65ad\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nint a&#91;1000000];\nvoid solve(){\n\tint n;\n\tcin &gt;&gt; n;\n\tint sum = 0;\n\tint minn = 0x3f3f3f3f;\n\tint flag = 0;\n\tfor(int i = 1;i &lt;= n;i++){\n\t\tcin &gt;&gt; a&#91;i];\n\t\tif(a&#91;i] &gt; 0) {\n\t\t\tminn = min(minn,a&#91;i]);\n\t\t\tflag = 1;\n\t\t}\n\t}\n\tsort(a + 1,a + n + 1);\n\t\/\/\u5982\u679c\u662f\u975e\u6b63\u6570\u6211\u4eec\u90fd\u53d6\n\tfor(int i = 1;i &lt;= n;i++){\n\t\tif(a&#91;i] &lt;= 0) sum++;\n\t}\n\t\/\/\u5b58\u5728\u6b63\u6570\n\tif(flag){\n\t\tint temp = 0x3f3f3f3f;\n\t\t\/\/\u8003\u8651\u662f\u5426\u8981\u53d6\u6700\u5c0f\u7684\u6b63\u6570\n\t\tfor(int i = 2;i &lt;= n;i++){\n\t\t\tif(a&#91;i] &gt; 0) break;\n\t\t\ttemp = min(a&#91;i] - a&#91;i - 1],temp);\n\t\t}\n\t\t\/\/\u975e\u6b63\u6570\u4eec\u7684\u6700\u5c0f\u5dee\u503c\u8981\u5927\u4e8e\u7b49\u4e8e\u6700\u5c0f\u7684\u6b63\u6570\uff0c\u624d\u80fdsum+1\n\t\tfor(int i = 1;i &lt;= n;i++){\n\t\t\tif(temp &gt;= minn){\n\t\t\t\tsum++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tcout &lt;&lt; sum &lt;&lt; \"\\n\";\n}\nint main(){\n\tint t;\n\tcin &gt;&gt; t;\n\twhile(t--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">H &#8211; Nastia and Nearly Good Numbers Nastia\u548c\u51e0\u4e4e\u597d\u7684\u6570<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>Nastia\u6709\u4e24\u4e2a\u6b63\u6574\u6570A\u548cB\u3002\u5979\u5b9a\u4e49\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4e00\u4e2a\u6574\u6570\u80fd\u88abA\u548cB\u7684\u4e58\u79ef\u6574\u9664\uff0c\u90a3\u4e48\u8fd9\u4e2a\u6574\u6570\u5c31\u662f\u597d\u7684\uff1b<\/li>\n\n\n\n<li>\u5426\u5219\uff0c\u5982\u679c\u4e00\u4e2a\u6574\u6570\u80fd\u88abA\u6574\u9664\uff0c\u90a3\u4e48\u8fd9\u4e2a\u6574\u6570\u5c31\u662f\u8fd1\u4f3c\u597d\u7684\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4f8b\u5982\uff0c\u5982\u679cA=6\uff0cB=4\uff0c\u90a3\u4e48\u6574\u657024\u548c72\u662f\u597d\u7684\uff0c\u6574\u65706\uff0c660\u548c12\u662f\u8fd1\u4f3c\u597d\u7684\uff0c\u6574\u657016\uff0c7\u65e2\u4e0d\u597d\u4e5f\u4e0d\u8fd1\u4f3c\u597d\u3002<\/p>\n\n\n\n<p>\u4f60\u7684\u4efb\u52a1\u662f\u627e\u5230\u4e09\u4e2a<strong>\u4e0d\u540c<\/strong>\u7684\u6b63\u6574\u6570x\uff0cy\uff0c\u548cz\uff0c\u4f7f\u5f97\u5b83\u4eec\u4e2d\u6070\u597d\u6709\u4e00\u4e2a\u662f\u597d\u7684\uff0c\u5176\u4ed6\u4e24\u4e2a\u662f\u8fd1\u4f3c\u597d\u7684\uff0c\u5e76\u4e14x+y=z\u3002<\/p>\n\n\n\n<p>\u8f93\u5165\u683c\u5f0f\uff1a \u7b2c\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u5355\u72ec\u7684\u6574\u6570t (1\u2264t\u226410000) \u2014 \u6d4b\u8bd5\u7528\u4f8b\u7684\u6570\u91cf\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u7684\u7b2c\u4e00\u884c\u5305\u542b\u4e24\u4e2a\u6574\u6570A\u548cB (1\u2264A\uff0cB\u226410^6) \u2014 Nastia\u62e5\u6709\u7684\u6570\u5b57\u3002<\/p>\n\n\n\n<p>\u8f93\u51fa\u683c\u5f0f\uff1a \u5bf9\u4e8e\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\uff0c\u6253\u5370\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u5b58\u5728\u7b54\u6848\uff0c\u6253\u5370&#8221;YES&#8221;\uff0c\u5e76\u7ed9\u51fa\u4e09\u4e2a\u4e0d\u540c\u7684\u6b63\u6574\u6570x\uff0cy\uff0c\u548cz <strong>(1\u2264x\uff0cy\uff0cz\u226410^18)<\/strong>\uff0c\u4f7f\u5f97\u5b83\u4eec\u4e2d\u6070\u597d\u6709\u4e00\u4e2a\u662f\u597d\u7684\uff0c\u5176\u4ed6\u4e24\u4e2a\u662f\u8fd1\u4f3c\u597d\u7684\uff0c\u5e76\u4e14x+y=z\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u4e0d\u5b58\u5728\u7b54\u6848\uff0c\u6253\u5370&#8221;NO&#8221;\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u7528\u4efb\u4f55\u5927\u5c0f\u5199\u6253\u5370&#8221;YES&#8221;\u6216&#8221;NO&#8221;\u3002<strong>\u5982\u679c\u6709\u591a\u4e2a\u7b54\u6848\uff0c\u6253\u5370\u4efb\u4f55\u4e00\u4e2a\u5373\u53ef\u3002<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/H\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u73b0\u5728\u6211\u4eec\u6765\u68b3\u7406\u9898\u76ee\uff0c\u5c31\u662f\u6211\u4eec\u9700\u8981\u627e\u4e00\u627e\u6709\u6ca1\u6709\u4e00\u7ec4\u4e0d\u540c\u7684x y z\u6ee1\u8db3x + y = z\u4e14\u5176\u4e2d\u4e00\u4e2a\u662f\u597d\u7684\uff0c\u53e6\u5916\u4e24\u4e2a\u662f\u8fd1\u4f3c\u597d\u7684\u3002\u4e5f\u5c31\u662f\u6709\u4e00\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88abAB\u6574\u9664\uff0c\u53e6\u5916\u4e24\u4e2a\u90fd\u662f\u53ef\u4ee5\u88abA\u6574\u9664\uff0c\u4e0d\u80fd\u88abB\u6574\u9664\u3002\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\u6240\u6709\u53d8\u91cf\u90fd\u80fd\u88abA\u6574\u9664\uff0c\u6211\u4eec\u628ax\u3001y\u3001z\u540c\u9664\u4ee5A\uff0c\u53ef\u4ee5\u5f97\u5230\u4e00\u4e2aB\u7684\u8868\u8fbe\u5f0f\u3002\u9996\u5148\u6211\u4eec\u6765\u601d\u8003\uff0c\u4ec0\u4e48\u65f6\u5019\u4f1a\u8f93\u51faNO\uff1f\u5bf9\u4e8eA\u6765\u8bf4\uff0c\u6211\u4eec\u4e00\u5b9a\u80fd\u627e\u5230\u4e00\u7ec4xyz\u7684\u516c\u56e0\u5b50\u662fA\u3002\u5bf9\u4e8eB\u6765\u8bf4\uff0c\u5982\u679cB\u4e3a1,\u5219\u6761\u4ef61\u548c2\u6ca1\u7528\u533a\u522b\u4e86\uff0c\u56e0\u4e3a\u8c01\u90fd\u80fd\u88abAB\u7684\u4e58\u79ef\u6574\u9664\u4e86\uff0c\u5982\u679c\u4e00\u4e2a\u6570\u662f\u8fd1\u4f3c\u597d\u7684\uff0c\u5b83\u4e5f\u4e00\u5b9a\u662f\u597d\u7684\u3002\u6240\u6709\u8fd9\u4e2a\u65f6\u5019\u5c31\u4e0d\u4f1a\u6ee1\u8db3\u3010\u5176\u4e2d\u4e00\u4e2a\u662f\u597d\u7684\uff0c\u53e6\u5916\u4e24\u4e2a\u662f\u8fd1\u4f3c\u597d\u7684\u3011\u7684\u6761\u4ef6\u3002<\/p>\n\n\n\n<p>\u6240\u6709\u5f53B = 1\u7684\u65f6\u5019\u8f93\u51faNO\u3002<\/p>\n\n\n\n<p>\u5f53B &gt; 1\u7684\u65f6\u5019\uff0c\u5219\u6709AB = A + A * (B &#8211; 1)\u4e00\u5b9a\u662f\u6ee1\u8db3x + y = z\u7684\u6761\u4ef6\u3002\u6b64\u65f6\uff0cz\u4e00\u5b9a\u662f\u597d\u7684\uff0cA\u548cA * (B &#8211; 1)\u4e00\u5b9a\u662f\u8fd1\u4f3c\u597d\u7684\u3002\u770b\u8d77\u6765\u5df2\u7ecf\u6ee1\u8db3\u6761\u4ef6\u4e86\u3002<\/p>\n\n\n\n<p><strong>\u4f46\u662f\u3002<\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u4f1a\u53d1\u73b0B = 2\u7684\u65f6\u5019\uff0cx \u548c y\u76f8\u7b49\uff0c\u8fd9\u4e0e\u9898\u76ee\u8981\u6c42\u4e0d\u7b26\u5408\u3002\u6240\u4ee5\u6211\u4eec\u7684<strong>\u6784\u9020<\/strong>\u53ef\u4ee5\u6362\u6210 A(B + 1) = AB + A\uff0c\u6b64\u65f6\u4e00\u6837\u6ee1\u8db3\u6761\u4ef6\uff0c\u4e14\u4e0d\u5b58\u5728\u76f8\u7b49\u7684\u60c5\u51b5\u3002\u6b64\u65f6x\u4e3aAB\uff0cy\u4e3aA\uff0cz\u4e3aA(B + 1)\u3002<\/p>\n\n\n\n<p><em><strong>\u8fd9\u9898\u6ce8\u610f\u8981\u5f00long long\u3002<\/strong><\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nvoid solve(){\n\tlong long a,b;\n\tcin &gt;&gt; a &gt;&gt; b;\n\tif(b == 1){\n\t\tcout &lt;&lt; \"NO\" &lt;&lt; \"\\n\";\n\t\treturn;\n\t}else{\n\t\tcout &lt;&lt; \"YES\" &lt;&lt; \"\\n\";\n\t\tcout &lt;&lt; a * b &lt;&lt; \" \" &lt;&lt; a &lt;&lt; \" \" &lt;&lt; a * (b + 1) &lt;&lt; \"\\n\";\n\t}\n}\nint main(){\n\tint t;\n\tcin &gt;&gt; t;\n\twhile(t--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">I &#8211; A-B Palindrome A-B \u56de\u6587<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u4f60\u5c06\u5f97\u5230\u4e00\u4e2a\u7531\u5b57\u7b26 &#8216;0&#8217;\uff0c&#8217;1&#8242; \u548c &#8216;?&#8217; \u7ec4\u6210\u7684\u5b57\u7b26\u4e32s\u3002\u4f60\u9700\u8981\u5c06\u5b57\u7b26\u4e32s\u4e2d\u7684\u6240\u6709 &#8216;?&#8217; \u5b57\u7b26\u66ff\u6362\u4e3a &#8216;0&#8217; \u6216 &#8216;1&#8217;\uff0c\u4f7f\u5f97\u66ff\u6362\u540e\u7684\u5b57\u7b26\u4e32\u6210\u4e3a\u4e00\u4e2a\u56de\u6587\u4e32\uff0c\u5e76\u4e14\u6070\u597d\u6709a\u4e2a &#8216;0&#8217; \u5b57\u7b26\u548cb\u4e2a &#8216;1&#8217; \u5b57\u7b26\u3002\u6ce8\u610f\uff0c\u6bcf\u4e2a &#8216;?&#8217; \u5b57\u7b26\u7684\u66ff\u6362\u90fd\u662f\u72ec\u7acb\u4e8e\u5176\u4ed6\u5b57\u7b26\u7684\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4e00\u4e2a\u957f\u5ea6\u4e3an\u7684\u5b57\u7b26\u4e32t\u6ee1\u8db3\u6240\u6709\u7684 t[i]=t[n\u2212i+1] (1\u2264i\u2264n)\uff0c\u90a3\u4e48\u6211\u4eec\u79f0\u8fd9\u4e2a\u5b57\u7b26\u4e32\u4e3a\u56de\u6587\u4e32\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u5982\u679c s=&#8221;01?????0&#8243;, a=4 \u548c b=4\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u6309\u4ee5\u4e0b\u65b9\u5f0f\u66ff\u6362 &#8216;?&#8217; \u5b57\u7b26\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8220;01011010&#8221;;<\/li>\n\n\n\n<li>&#8220;01100110&#8221;.<\/li>\n<\/ul>\n\n\n\n<p>\u5bf9\u4e8e\u7ed9\u5b9a\u7684\u5b57\u7b26\u4e32s\u548c\u6570\u5b57a\u548cb\uff0c\u5c06\u5b57\u7b26\u4e32s\u4e2d\u7684\u6240\u6709 &#8216;?&#8217; \u5b57\u7b26\u66ff\u6362\u4e3a &#8216;0&#8217; \u6216 &#8216;1&#8217;\uff0c\u4f7f\u5f97\u5b57\u7b26\u4e32\u6210\u4e3a\u4e00\u4e2a\u56de\u6587\u4e32\uff0c\u5e76\u4e14\u6070\u597d\u6709a\u4e2a &#8216;0&#8217; \u5b57\u7b26\u548cb\u4e2a &#8216;1&#8217; \u5b57\u7b26\u3002<\/p>\n\n\n\n<p>\u8f93\u5165\u683c\u5f0f\uff1a \u7b2c\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u5355\u72ec\u7684\u6574\u6570t (1\u2264t\u226410^4)\u3002\u7136\u540e\u662ft\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u7684\u7b2c\u4e00\u884c\u5305\u542b\u4e24\u4e2a\u6574\u6570a\u548cb (0\u2264a,b\u22642\u22c510^5\uff0ca+b\u22651)\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u7684\u7b2c\u4e8c\u884c\u5305\u542b\u4e00\u4e2a\u957f\u5ea6\u4e3aa+b\u7684\u5b57\u7b26\u4e32s\uff0c\u7531\u5b57\u7b26 &#8216;0&#8217;\uff0c&#8217;1&#8242; \u548c &#8216;?&#8217; \u7ec4\u6210\u3002<\/p>\n\n\n\n<p>\u4fdd\u8bc1\u6240\u6709\u6d4b\u8bd5\u7528\u4f8b\u7684\u5b57\u7b26\u4e32s\u7684\u957f\u5ea6\u603b\u548c\u4e0d\u8d85\u8fc72\u22c510^5\u3002<\/p>\n\n\n\n<p>\u8f93\u51fa\u683c\u5f0f\uff1a \u5bf9\u4e8e\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\uff0c\u8f93\u51fa\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4e0d\u80fd\u5c06\u5b57\u7b26\u4e32s\u4e2d\u7684\u6240\u6709 &#8216;?&#8217; \u5b57\u7b26\u66ff\u6362\u4e3a &#8216;0&#8217; \u6216 &#8216;1&#8217; \u4f7f\u5f97\u5b57\u7b26\u4e32\u6210\u4e3a\u4e00\u4e2a\u56de\u6587\u4e32\u5e76\u4e14\u6070\u597d\u5305\u542ba\u4e2a &#8216;0&#8217; \u548cb\u4e2a &#8216;1&#8217;\uff0c\u5219\u8f93\u51fa &#8220;-1&#8243;\uff1b<\/li>\n\n\n\n<li>\u5426\u5219\uff0c\u8f93\u51fa\u66ff\u6362\u540e\u5f97\u5230\u7684\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u5982\u679c\u6709\u591a\u79cd\u9002\u5f53\u7684\u66ff\u6362\u65b9\u5f0f\uff0c\u4f60\u53ef\u4ee5\u8f93\u51fa\u4efb\u4f55\u4e00\u79cd\u3002<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/I\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u8fd9\u9898\u5927\u81f4\u610f\u601d\u5c31\u662f\u8ba9\u6211\u4eec\u627e\u56de\u6587\u5b57\u7b26\u4e32\u3002\u5176\u5b9e\u8bfb\u5b8c\u9898\u81ea\u7136\u5c31\u80fd\u5f97\u5230\u4e00\u4e2a\u5f88\u6734\u7d20\u7684\u601d\u8def\u3002\u5c31\u662f\u6211\u4eec\u5148\u5de6\u53f3\u5bf9\u79f0\u7740\u770b\uff0c\u5148\u8ba9\u5b57\u7b26\u4e32\u60f3\u529e\u6cd5\u5bf9\u79f0\uff0c\u7136\u540e\u518d\u53bb\u770b\u770b\u5269\u4f59\u53ef\u7528\u7684 &#8216;0&#8217; \u548c &#8216;1&#8217; \u7684\u4e2a\u6570\u662f\u5426\u6ee1\u8db3\u53cc\u95ee\u53f7\u7684\u60c5\u51b5\u3002<\/p>\n\n\n\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u6211\u4eec\u5148\u8003\u8651\uff0c\u5269\u4f59\u7684a\u3001b\u53ef\u5426\u6ee1\u8db3\u4e00\u8fb9\u662f\u95ee\u53f7\uff0c\u53e6\u4e00\u8fb9\u4e0d\u662f\u95ee\u53f7\u7684\u60c5\u51b5\uff0c\u5982\u679c\u53ef\u4ee5\uff0c\u6211\u4eec\u5c31\u586b\u8fdb\u53bb\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u5bf9\u79f0\u4e24\u8fb9\u90fd\u4e0d\u662f\u95ee\u53f7\uff0c\u90a3\u6211\u4eec\u5c31\u770b\u770b\u5b83\u4eec\u662f\u5426\u76f8\u7b49\uff0c\u4e0d\u76f8\u7b49\u5c31\u76f4\u63a5\u7ed3\u675f\u3002<\/p>\n\n\n\n<p>\u6700\u540e\u7684\u6700\u540e\uff0c\u6211\u4eec\u624d\u5f00\u59cb\u8003\u8651\u53cc\u95ee\u53f7\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u6bcf\u6b21\u51cf2\u4e2aa\u6216\u8005b\uff0c\u770b\u770b\u6700\u540e\u80fd\u4e0d\u80fd\u6ee1\u8db3\u3002\u6ce8\u610f\uff0c\u8981\u8003\u8651\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a\u5947\u6570\u7684\u60c5\u51b5\uff0c\u6b64\u65f6\u5bf9\u79f0\u4e24\u8fb9\u4f1a\u6307\u5411\u6700\u4e2d\u95f4\u7684\u90a3\u4e2a\u5b57\u7b26\uff0c\u6211\u4eec\u9700\u8981\u7279\u522b\u5224\u65ad\u4e00\u4e0b\uff0c\u6b64\u65f6\u53ea\u8981\u51cf1\u4e2aa\u6216\u8005b\u5c31\u884c\u3002<\/p>\n\n\n\n<p>\u6700\u540e\u5224\u65ada\u548cb\u7684\u4e2a\u6570\u662f\u5426\u6ee1\u8db3\u4e86\uff0c\u6ee1\u8db3\u5c31\u6b63\u786e\uff0c\u4e0d\u6ee1\u8db3\u5c31\u8f93\u51fa-1\u3002<\/p>\n\n\n\n<p>\u603b\u7ed3\u4e00\u4e0b\uff0c\u8fd9\u9053\u9898\u7c7b\u4f3c\u4e00\u79cd\u53cc\u6307\u9488\uff0c\u7528\u4e00\u4e2a i \u548c n &#8211; i &#8211; 1 \u6765\u627e\u56de\u6587\u4e5f\u662f\u5f88\u5e38\u89c1\u7684\u505a\u6cd5\u4e86\u3002<\/p>\n\n\n\n<p>\u8fd9\u9053\u9898\u7b97\u662f\u4e2a\u6a21\u62df\u9898\uff0c\u9700\u8981\u8bfb\u8005\u6709\u4e00\u5b9a\u8010\u5fc3\uff0c\u7b14\u8005\u7684\u4ee3\u7801\u53ef\u80fd\u6bd4\u8f83\u7e41\u590d\u3001\u4e0d\u6613\u7406\u89e3\uff0c\u63a8\u8350\u8bfb\u8005\u6839\u636e\u601d\u8def\u81ea\u884c\u64b0\u5199\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nvoid solve(){\n\tint a,b;\n\tcin &gt;&gt; a &gt;&gt; b;\n\tstring s;\n\tcin &gt;&gt; s;\n\tint n = s.size();\n\tfor(int i = 0;i &lt; n;i++){\n\t\tif(s&#91;i]=='0')\n\t\t\ta--;\n\t\tif(s&#91;i]=='1')\n\t\t\tb--;\n\t}\n\tfor(int i = 0;i &lt;= n\/2;i++){\n\t\t\/\/\u90fd\u4e0d\u662f\u95ee\u53f7\u7684\u60c5\u51b5\n\t\tif(s&#91;i] != '?' &amp;&amp; s&#91;n - i - 1] != '?'){\n\t\t\tif(s&#91;i] != s&#91;n - i - 1]){\n\t\t\t\tcout &lt;&lt; -1 &lt;&lt; \"\\n\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}else if(s&#91;i] == '?' &amp;&amp; s&#91;i] == s&#91;n - i - 1]){\/\/\u90fd\u662f\u95ee\u53f7\n\t\t\tcontinue;\n\t\t}else{\/\/\u6709\u4e00\u8fb9\u662f\u95ee\u53f7\u7684\u60c5\u51b5\n\t\t\tif(s&#91;i] != '?'){\n\t\t\t\tif(s&#91;i] == '0') {\n\t\t\t\t\ta--;\n\t\t\t\t\ts&#91;n - i - 1] = '0';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tb--;\n\t\t\t\t\ts&#91;n - i - 1] = '1';\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(s&#91;n - i - 1] == '0') {\n\t\t\t\t\ta--;\n\t\t\t\t\ts&#91;i] = '0';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tb--;\n\t\t\t\t\ts&#91;i] = '1';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(a &lt; 0 || b &lt; 0){ \n\t\t\t\tcout &lt;&lt; -1 &lt;&lt; \"\\n\";\n\t\t\t\treturn; \n\t\t\t}\n\t\t}\n\t}\n\n\t\/\/\u6700\u540e\u5355\u72ec\u5904\u7406\u90fd\u662f\u95ee\u53f7\u7684\u60c5\u51b5\n\tfor(int i = 0;i &lt;= n\/2;i++){\n\t\tif(s&#91;i] == '?' &amp;&amp; s&#91;i] == s&#91;n - i - 1] &amp;&amp; i != n - i - 1){\n\t\t\tif(a &gt;= 2){\n\t\t\t\ta -= 2;\n\t\t\t\ts&#91;i] = s&#91;n - i - 1] = '0';\n\t\t\t}else if(b &gt;= 2){\n\t\t\t\tb -= 2;\n\t\t\t\ts&#91;i] = s&#91;n - i - 1] = '1';\n\t\t\t}\n\t\t}\n\t\tif(s&#91;i] == '?'  &amp;&amp; i == n - i - 1){\n\t\t\tif(a &gt; 0){\n\t\t\t\ta -= 1;\n\t\t\t\ts&#91;i] = '0';\n\t\t\t}else{\n\t\t\t\tb -= 1;\n\t\t\t\ts&#91;i] = '1';\n\t\t\t}\n\t\t}\n\t}\n\tif(a != 0 || b != 0){\n\t\tcout &lt;&lt; -1 &lt;&lt; \"\\n\";\n\t\treturn; \n\t}\n\tcout &lt;&lt; s &lt;&lt; \"\\n\";\n}\nint main(){\n\tint t;\n\tcin &gt;&gt; t;\n\twhile(t--) solve();\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">J &#8211; Repainting Street \u91cd\u7ed8\u8857\u9053<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u610f\uff1a<\/h2>\n\n\n\n<p>\u8fd9\u662f\u4e00\u6761\u6709n\u680b\u623f\u5b50\u7684\u8857\u9053\uff0c\u8fd9\u4e9b\u623f\u5b50\u6309\u987a\u5e8f\u4ece1\u5230n\u7f16\u53f7\u3002\u623f\u5b50i\u6700\u521d\u88ab\u6d82\u6210\u4e86\u989c\u8272ci\u3002\u5982\u679c\u6240\u6709\u623f\u5b50\u90fd\u88ab\u6d82\u6210\u76f8\u540c\u7684\u989c\u8272\uff0c\u90a3\u4e48\u8fd9\u6761\u8857\u9053\u5c31\u88ab\u8ba4\u4e3a\u662f\u7f8e\u4e3d\u7684\u3002\u753b\u5bb6Tom\u8d1f\u8d23\u4f7f\u8857\u9053\u53d8\u5f97\u7f8e\u4e3d\u3002Tom\u7684\u7ed8\u753b\u80fd\u529b\u7531\u4e00\u4e2a\u6574\u6570k\u5b9a\u4e49\u3002<\/p>\n\n\n\n<p>\u5728\u4e00\u5929\u4e2d\uff0cTom\u53ef\u4ee5\u8fdb\u884c\u4ee5\u4e0b\u7531\u4e24\u4e2a\u6b65\u9aa4\u7ec4\u6210\u7684\u91cd\u7ed8\u8fc7\u7a0b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4ed6\u9009\u62e9\u4e24\u4e2a\u6574\u6570l\u548cr\uff0c\u6ee1\u8db31\u2264l\u2264r\u2264n\u4e14r\u2212l+1=k\u3002<\/li>\n\n\n\n<li>\u5bf9\u4e8e\u6bcf\u4e2a\u6ee1\u8db3l\u2264i\u2264r\u7684\u623f\u5b50i\uff0c\u4ed6\u53ef\u4ee5\u7528\u4ed6\u60f3\u8981\u7684\u4efb\u4f55\u989c\u8272\u91cd\u65b0\u6d82\u88c5\u5b83\uff0c\u6216\u8005\u5ffd\u7565\u5b83\uff0c\u8ba9\u5b83\u4fdd\u6301\u5f53\u524d\u7684\u989c\u8272\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u6ce8\u610f\uff0c\u540c\u4e00\u5929\u5185\uff0cTom\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u989c\u8272\u6765\u91cd\u7ed8\u4e0d\u540c\u7684\u623f\u5b50\u3002<\/p>\n\n\n\n<p>Tom\u60f3\u77e5\u9053\uff0c\u8981\u4f7f\u8857\u9053\u53d8\u5f97\u7f8e\u4e3d\uff0c\u9700\u8981\u7684\u6700\u5c11\u5929\u6570\u662f\u591a\u5c11\u3002<\/p>\n\n\n\n<p>\u8f93\u5165\u683c\u5f0f\uff1a \u8f93\u5165\u7684\u7b2c\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u5355\u72ec\u7684\u6574\u6570t\uff081\u2264t\u226410^4\uff09\uff0c\u5373\u6d4b\u8bd5\u7528\u4f8b\u7684\u6570\u91cf\u3002\u63a5\u4e0b\u6765\u662f\u6d4b\u8bd5\u7528\u4f8b\u7684\u63cf\u8ff0\u3002<\/p>\n\n\n\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u63cf\u8ff0\u7684\u7b2c\u4e00\u884c\u6709\u4e24\u4e2a\u6574\u6570n\u548ck\uff081\u2264k\u2264n\u226410^5\uff09\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e8c\u884c\u5305\u542bn\u4e2a\u7a7a\u683c\u5206\u9694\u7684\u6574\u6570\u3002<strong>\u5176\u4e2d\u7b2ci\u4e2a\u6574\u6570\u8868\u793aci\uff081\u2264ci\u2264100\uff09\uff0c\u5373\u623f\u5b50i\u6700\u521d\u7684\u989c\u8272\u3002<\/strong><\/p>\n\n\n\n<p>\u4fdd\u8bc1\u6240\u6709\u6d4b\u8bd5\u7528\u4f8b\u4e2d\u7684n\u7684\u603b\u548c\u4e0d\u8d85\u8fc710^5\u3002<\/p>\n\n\n\n<p>\u8f93\u51fa\u683c\u5f0f\uff1a \u6253\u5370t\u884c\uff0c\u6bcf\u884c\u4e00\u4e2a\u6574\u6570\uff1aTom\u4e3a\u6bcf\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u4f7f\u8857\u9053\u53d8\u7f8e\u6240\u9700\u7684\u6700\u5c11\u5929\u6570\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/vjudge.net\/contest\/605734#problem\/J\">nenu \u84dd\u6865\u676f\u8bad\u7ec3\u8d5b\uff08\u7b80\u5355\u6a21\u62df+\u601d\u7ef4\uff09 &#8211; Virtual Judge (vjudge.net)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def\uff1a<\/h2>\n\n\n\n<p>\u8fd9\u9053\u9898\u5176\u5b9e\u5c31\u662f\u5f88\u66b4\u529b\u7684\u505a\u6cd5\u3002\u6211\u4eec\u770b\u5230\u9898\u76ee\uff0c\u53d1\u73b0\u6bcf\u6b21\u8981\u6d82\u8272\u5bf9\u5427\uff0c\u800c\u4e14\u6bcf\u6b21\u6d82\u8272\u5c31\u662f\u6d82\u4e00\u7247\u533a\u57df\uff0c\u6240\u4ee5\u6211\u4eec\u6bcf\u6b21\u9047\u5230\u9700\u8981\u6d82\u8272\u7684\u60c5\u51b5\uff0c\u5c31\u628a\u8fd9\u7bc7\u533a\u57df\u90fd\u6d82\u4e0a\uff0c\u7136\u540e\u8df3\u5230\u8fd9\u7247\u533a\u57df\u4e4b\u540e\u7ee7\u7eed\u770b\u8fd8\u6709\u6ca1\u6709\u9700\u8981\u6d82\u8272\u7684\u60c5\u51b5\u3002\u6211\u4eec\u4f1a\u53d1\u73b0\u5176\u5b9e\u6d82\u8272\u7684\u60c5\u51b5\u53ea\u6709100\u79cd\uff0c\u975e\u5e38\u7684\u5c11\uff0c\u6211\u4eec\u628a\u6bcf\u4e00\u79cd\u60c5\u51b5\u90fd\u8003\u8651\u4e00\u6b21\uff1a\u7b2c\u4e00\u6b21\uff0c\u6211\u4eec\u8ba4\u4e3a\u6240\u6709\u623f\u5b50\u90fd\u8981\u662f\u989c\u82721\uff0c\u7b2c\u4e8c\u6b21\u6211\u4eec\u8ba4\u4e3a\u6240\u6709\u623f\u5b50\u90fd\u8981\u662f\u989c\u82722\u2026\u2026\u8fd9\u6837\u628a\u6240\u6709\u60c5\u51b5\u90fd\u679a\u4e3e\u4e00\u6b21\uff0c\u53d6\u6700\u5c0f\u503c\u5c31\u662f\u7ed3\u679c\u4e86\u3002<\/p>\n\n\n\n<p>\u7b80\u5355\u6765\u60f3\u5c31\u662f\uff0c\u6211\u4eec\u9047\u5230\u548c\u6211\u4eec\u60f3\u8981\u7684\u989c\u8272\u4e0d\u76f8\u540c\u7684\u5c31\u6d82\u8272\uff0c\u7136\u540e\u5982\u679c\u518d\u9047\u5230\u5c31\u518d\u6d82\u8272\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e00\u5b9a\u4e0d\u4f1a\u6f0f\u6389\u4efb\u4f55\u4e00\u4e2a\u623f\u5b50\u3002\u7136\u540e\u628a100\u79cd\u60c5\u51b5\u90fd\u8bd5\u4e00\u8bd5\u5c31\u884c\u4e86\u3002\u5b9e\u73b0\u8d77\u6765\u7684\u4ee3\u7801\u6709\u70b9\u7c7b\u4f3c\u4e8eC &#8211; \u7a3b\u8349\u4eba\u90a3\u9053\u9898\uff0c\u90fd\u662f\u5224\u65ad\u4e4b\u540e\u5c31\u8df3\u8fc7\u4e00\u4e2a\u533a\u57df\u3002<\/p>\n\n\n\n<p>\u867d\u7136\u8bb2\u8d77\u6765\u6bd4\u8f83\u590d\u6742\uff0c\u4f46\u662f\u4ee3\u7801\u8fd8\u662f\u5f88\u597d\u61c2\u7684\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801C++\uff1a<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h>\r\nusing namespace std;\r\nconst int MAXN = 1e5 + 7;\r\nint a&#91;MAXN];\r\nvoid solve(){\r\n\tint n,k;\r\n\tcin >> n >> k;\r\n\tfor(int i = 1;i &lt;= n;i++){\r\n\t\tcin >> a&#91;i];\r\n\t}\r\n\tint sum = 0x3f3f3f3f;\r\n\t\/\/\u679a\u4e3e\u4e00\u767e\u79cd\u989c\u8272\r\n\tfor(int i = 1;i &lt;= 100;i++){\r\n\t\tint cnt = 0;\r\n\t\t\/\/\u6bcf\u4e00\u8f6e\u90fd\u9009\u4e2d\u4e00\u79cd\u989c\u8272\uff0c\u770b\u770b\u5982\u679c\u5168\u90e8\u53d8\u6210\u8fd9\u79cd\u989c\u8272\u8981\u591a\u5c11\u6b21\r\n\t\tfor(int j = 1;j &lt;= n;j++){\r\n\t\t\t\/\/\u9047\u5230\u9700\u8981\u6d82\u8272\u7684\u5c31\u5f00\u59cb\u6d82\uff0c\u7136\u540e\u8df3\u8fc7\u6d82\u5b8c\u7684\u533a\u57df\r\n\t\t\tif(a&#91;j] != i){\r\n\t\t\t\tcnt++;\r\n\t\t\t\tj += k - 1;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t}\r\n\t\tsum = min(cnt,sum);\r\n\t}\r\n\tcout &lt;&lt; sum &lt;&lt; \"\\n\";\r\n}\r\nint main(){\r\n\tint t;\r\n\tcin >> t;\r\n\twhile(t--) solve();\r\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u603b\u7ed3<\/h1>\n\n\n\n<p>\u8fd9\u4e00\u5957\u9898\u96be\u5ea6\u504f\u4f4e\uff0c\u4ee3\u7801\u91cf\u4e3b\u8981\u96c6\u4e2d\u4e8e\u6a21\u62df\uff0c\u6709\u4e9b\u8bb8\u601d\u7ef4\u91cf\u3002<\/p>\n\n\n\n<p>\u53ef\u4ee5\u603b\u7ed3\u51fa\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u591a\u8bfb\u9898\uff0c\u5206\u6790\u9898\u76ee\u672c\u8eab\u7684\u5b9a\u4e49\uff0c\u6216\u8bb8\u5c31\u6709\u4e86\u6784\u9020\u7684\u601d\u8def\u3002\u5047\u8bbe\u6ca1\u6709\u4ec0\u4e48\u601d\u8def\uff0c\u5c3d\u81ea\u5df1\u6240\u80fd\u5f00\u59cb\u5206\u7c7b\u8ba8\u8bba\uff0c\u63a2\u7a76\u6bcf\u4e00\u79cd\u60c5\u51b5\u3002\u3010\u5206\u7c7b\u8ba8\u8bba\u7684\u65b9\u5411\u53ef\u4ee5\u4ece\u6837\u4f8b\u5f00\u59cb\u8003\u8651\uff0c\u901a\u5e38\u662f\u5206\u7c7b\u8ba8\u8bba\u6570\u5b57\u7684\u5927\u5c0f\u6216\u8005\u4e2a\u6570\u3001\u6b63\u8d1f\u7b49\u7b49\u3011<\/li>\n\n\n\n<li>\u770b\u5230\u5f88\u5c0f\u7684\u90a3\u79cd\u6570\u636e\u8303\u56f4\uff0c\u6bd4\u5982D\u9898\u7684[1,1000]\u6216\u8005J\u9898\u7684[1,100]\uff0c\u5176\u5b9e\u90fd\u63d0\u9192\u4e86\u6211\u4eec\u4e00\u4e9b\u505a\u9898\u7684\u7a81\u7834\u70b9\uff0c\u53ef\u4ee5\u66b4\u529b\u7a81\u7834\u3002<\/li>\n\n\n\n<li>\u770b\u5230\u3010\u4f60\u53ef\u4ee5\u8f93\u51fa\u4efb\u4f55\u4e00\u79cd\u3011\uff0c\u901a\u5e38\u8868\u793a\u9898\u76ee\u6709\u7279\u6b8a\u7684\u6784\u9020\u65b9\u6cd5\uff0c\u5c3d\u91cf\u8003\u8651\u7279\u5224\uff0c\u628a\u73a9\u6837\u4f8b\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>A &#8211; Chocolate Thief \u5de7\u514b\u529b\u5c0f\u5077 \u9898\u610f\uff1a \u6211\u7ed9\u4e86\u4e00\u4e9b\u5b66\u751f\u5de7\u514b\u529b\uff0c\u4ee5\u5956\u52b1\u4ed6\u4eec\u7684\u6770\u51fa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,8,3],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-9","category-8","category-3"],"_links":{"self":[{"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":19,"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/posts\/23\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nenuacm.top\/index.php\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}