{"id":194,"date":"2020-02-29T02:04:58","date_gmt":"2020-02-28T18:04:58","guid":{"rendered":"http:\/\/i.pegasi.top\/?p=194"},"modified":"2020-02-29T02:46:34","modified_gmt":"2020-02-28T18:46:34","slug":"%e4%b8%80%e4%b8%aa%e6%9c%89%e8%b6%a3%e7%9a%84%e5%b0%8f%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/www.4-xx.com\/index.php\/2020\/02\/29\/%e4%b8%80%e4%b8%aa%e6%9c%89%e8%b6%a3%e7%9a%84%e5%b0%8f%e9%97%ae%e9%a2%98\/","title":{"rendered":"\u4e00\u4e2a\u6709\u8da3\u7684\u5c0f\u95ee\u9898"},"content":{"rendered":"<p><span style=\"background-color: #ffffff;\"><strong>\u6709\u8fd9\u6837\u4e00\u4e2a\u6e38\u620f\uff1a<\/strong><\/span><\/p>\n<ul>\n<li><span style=\"background-color: #ffffff;\">\u6253\u5f00\u4f60\u7684\u8bb0\u4e8b\u672c\uff0c\u8f93\u5165\u4e00\u4e2a\"0\"\u3002<\/span><\/li>\n<li><span style=\"background-color: #ffffff;\">\u4f60\u670910\u6b21\u884c\u52a8\u56de\u5408<\/span><\/li>\n<li><span style=\"background-color: #ffffff;\">\u5728\u6bcf\u4e2a\u56de\u5408\u4e2d\uff0c\u4f60\u53ea\u80fd\uff1a\u2460\u518d\u8f93\u4e00\u4e2a\"0\" \u2461\u628a\u6240\u6709\u5185\u5bb9\u590d\u5236\u5230\u526a\u8d34\u677f \u2462\u7c98\u8d34<\/span><\/li>\n<\/ul>\n<p><span style=\"background-color: #ffffff;\">\u8bf7\u95ee\u572810\u6b21\u884c\u52a8\u56de\u5408\u7ed3\u675f\u540e\uff0c\u4f60\u7684\u8bb0\u4e8b\u672c<strong>\u6700\u591a<\/strong>\u80fd\u6709\u591a\u5c11\u4e2a\"0\"\uff1f<\/span><\/p>\n<hr \/>\n<p>\u8fd9\u662f\u6211\u5f88\u4e45\u4ee5\u524d\u8bd5\u56fe\u7528\u6700\u5feb\u65b9\u6cd5\u6253\u51fa\u6700\u591a\u4e2a\u5b57\u7b26\u65f6\u65e0\u804a\u60f3\u5230\u7684\u4e00\u4e2a\u95ee\u9898\uff0c\u5176\u5b9e\u8fd8\u633a\u7b80\u5355\u7684\uff08\u73b0\u5728\u77e5\u9053\u4e86\u7b54\u6848\u4ee5\u540e\u7684\u60f3\u6cd5\uff09\uff0c\u4f46\u662f\u5f53\u65f6\u60f3\u4e86\u5341\u51e0\u5206\u949f\u6ca1\u60f3\u660e\u767d\u3002\u4e4b\u540e\u53c8\u56e0\u4e3a\u5b66\u4e60\u539f\u56e0\uff0c\u5c31\u6401\u7f6e\u4e86\u4e0b\u6765\u3002\u73b0\u5728\u5bd2\u5047\u75ab\u60c5\u5728\u5bb6\u91cc\u6ca1\u4e8b\u5e72\uff0c\u53c8\u60f3\u5230\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u4fbf\u8bd5\u56fe\u89e3\u51b3\u4e00\u4e0b\u3002<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u53ef\u4ee5\u62bd\u8c61\u6210\u5bf9\u4e8e\u4e00\u4e2a\u6570\u5b571\uff0c\u4f60\u6bcf\u6b21\u80fd\u591f[0]\u52a0\u4e00\/[1]\u5b58\u53d6\u5f53\u524d\/[2]\u52a0\u4e0a\u5b58\u53d6\u7684\u6570\u5b57\uff0c\u7136\u540e\u670910\u6b21\u673a\u4f1a\u3002\u90a3\u8fd9\u91cc\u76f4\u63a5\u8bb0[0]\u4e3a\u505a\u4e86\u4e00\u6b21\u52a0\u4e00\u7684\u64cd\u4f5c\uff0c\u8bb0[1]\u4e3a\u5b58\u53d6\u5f53\u524d\u6570\u5b57\u7684\u64cd\u4f5c\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\u6bd4\u5982\u6570\u5b571\u5728[0,0,0]\u4e4b\u540e\u53d8\u6210\u4e864\uff08\u52a0\u4e86\u4e09\u6b21\u4e00\uff09\uff0c\u5728[0,1,2]\u4e4b\u540e\u4e5f\u53d8\u6210\u4e864\uff08\u52a0\u4e00\u7136\u540e\u590d\u5236\u5728\u52a0\u81ea\u8eab\uff0c\u76f8\u5f53\u4e8e\u52a0\u4e00\u540e\u7ffb\u500d\uff09\u3002<\/p>\n<p>\u90a3\u6211\u4eec\u5148\u7b80\u5355\u5730\u8bd5\u4e00\u4e0b\uff0c\u5f00\u5934\u80af\u5b9a\u8981\u591a\u52a0\u4e00\uff0c\u79ef\u7d2f\u5e95\u6570\uff0c\u7136\u540e\u590d\u5236\u4e00\u6b21\uff0c\u591a\u7c98\u8d34\u51e0\u6b21\uff0c\u5230\u4e86\u4e00\u5b9a\u7a0b\u5ea6\u540e\uff0c\u518d\u590d\u5236\u4e00\u4e0b\uff0c\u591a\u7c98\u8d34\u51e0\u6b21\uff0c\u55ef\uff0c\u76f4\u89c9\u4e0a\u662f\u8fd9\u6837\u6700\u5927\u3002\u90a3\u5c31[0,0,0,0,1,2,2,2,1,2]\u597d\u4e86\uff0c\u6700\u7ec8\u7ed3\u679c\u662f40\uff0c\u597d\u50cf\u633a\u5927\u4e86\u3002\u90a3\u8981\u662f\u65e9\u70b9\u5f00\u59cb\u590d\u5236\u5462\uff1f\u6bd4\u5982[0,0,1,2,1,2,1,2,1,2]\uff0c\u6700\u7ec8\u7ed3\u679c\u662f48\u3002\u8fd8\u6709\u66f4\u597d\u7684\u65b9\u6848\u5417\uff1femmmm\u2026\u2026\u591a\u8bd5\u51e0\u6b21\uff0c\u603b\u80fd\u8bd5\u51fa\u6700\u4f73\u7ed3\u679c\u7684\u5427\u2026\u2026\uff1f<\/p>\n<hr \/>\n<p>\u786e\u5b9e\uff0c\u60f3\u5230\u8fd9\u91cc\uff0c\u6211\u5c31\u60f3\u5230\u52a8\u7528python\u5927\u6cd5\u4e86\u3002\u90a3\u600e\u4e48\u7528\u4ee3\u7801\u53bb\u63cf\u8ff0\u8fd9\u4e2a\u8fc7\u7a0b\u5462\uff1f\u80af\u5b9a\u7528\u4e00\u4e2a\u53d8\u91cfa\u6765\u5b58\u503c\u3002[0]\u597d\u8bf4\uff0c\u5c31\u53d8\u91cfa\u7684\u503c\u52a0\u4e00\u3002[1]\u7684\u8bdd\uff0c\u518d\u5efa\u4e00\u4e2a\u53d8\u91cfb\u6765\u5b58\u5b58\u53d6\u7684\u503c\u3002[2]\u7684\u8bdd\u5c31\u662f\u53d8\u91cfa\u52a0\u4e00\u4e0b\u53d8\u91cfb\u91cc\u7684\u503c\u5c31\u597d\u4e86\u3002\u7136\u540e\u5206\u522b\u4e3a[0] [1] [2]\u8fd9\u4e09\u4e2a\u64cd\u4f5c\u5b9a\u4e49\u4e00\u4e0b\u76f8\u5e94\u7684\u51fd\u6570\uff0c\u653e\u4e00\u4e2a\u5217\u8868\u91cc\uff0c\u6839\u636e\u8f93\u5165\u7684\u503c\u6267\u884c\u76f8\u5e94\u7684\u64cd\u4f5c\u5c31\u597d\u4e86\u561b\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\ndef add():\r\n    global a\r\n    a=a+1\r\ndef copy():\r\n    global a,b\r\n    b=a\r\ndef paste():\r\n    global a,b\r\n    a=a+b\r\n    \r\na=1\r\nb=0\r\ncmdlst=[add,copy,paste]\r\ntimes=10\r\n\r\nfor i in range(times):\r\n    op=int(input(&quot;\u7b2c&quot;+str(i+1)+&quot;\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a&quot;))\r\n    cmdlst[op]()\r\n\r\nprint(&quot;\u7ed3\u675f\uff0c\u7ed3\u679c\u4e3a&quot;,a)\r\n<\/pre>\n<p>\u968f\u4fbf\u8dd1\u4e86\u4e00\u79cd\u7ed3\u679c<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\u7b2c1\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a0\r\n\u7b2c2\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a0\r\n\u7b2c3\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a1\r\n\u7b2c4\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a2\r\n\u7b2c5\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a1\r\n\u7b2c6\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a2\r\n\u7b2c7\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a1\r\n\u7b2c8\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a2\r\n\u7b2c9\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a1\r\n\u7b2c10\u6b21\u64cd\u4f5c\uff0c\u8f93\u51650\u62161\u62162\uff1a2\r\n\u7ed3\u675f\uff0c\u7ed3\u679c\u4e3a 48<\/pre>\n<p>\u7136\u540e\u5462\uff1f\u81ea\u5df1\u5bf9\u8fd9\u4e2a\u7834\u7a0b\u5e8f\u73a9\u4e00\u5e74\uff1f\u663e\u7136\u4e0d\u53ef\u80fd\uff0c\u5f53\u7136\u662f\u8ba9\u7a0b\u5e8f\u81ea\u5df1\u66b4\u529b\u679a\u4e3e\u5566~\u53cd\u6b63\u4e5f\u5c313^10\u79cd\u60c5\u51b5\uff0c\u6700\u540e\u8dd1\u51fa\u6765\u7684\u7ed3\u679c\u662f54\uff0c\u6b65\u9aa4\u4e3a[0, 0, 1, 2, 1, 2, 2, 1, 2, 2]\u3002<\/p>\n<hr \/>\n<p>\u95ee\u9898\u5230\u8fd9\u91cc\uff0c\u57fa\u672c\u4e5f\u544a\u4e00\u6bb5\u843d\uff0c\u5bf9\u4e8e\u53ea\u670910\u6b21\u6b65\u9aa4\u7684\u6e38\u620f\u6765\u8bf4\uff0c[0, 0, 1, 2, 1, 2, 2, 1, 2, 2]\u662f\u6700\u4f18\u89e3\uff0c\u6700\u7ec8\u4f1a\u670954\u4e2a\"0\"\u5462\uff01\u597d\u5427\uff0c\u4e5f\u4e0d\u662f\u5f88\u591a\u3002\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u6b65\u9aa4\u662f\u8fd9\u6837\u7684\uff0c\u8fd9\u91cc\u6682\u65f6\u4e0d\u597d\u8bf4\uff0c\u9700\u8981\u628a\u95ee\u9898<strong>\u63a8\u5e7f\u5230\u6709n\u6b21<\/strong>\u6e38\u620f\u6b65\u9aa4\uff0c\u518d\u627e\u627e\u770b\u89c4\u5f8b\u597d\u4e86\u3002<\/p>\n<p>\u65e2\u7136\u524d\u9762python\u7a0b\u5e8f\u5df2\u7ecf\u5199\u597d\u4e86\uff0c\u90a3\u5c31\u6539\u6539\u8ba9\u4ed6\u80fd\u7b97n\u6b21\u7684\u5427\u3002\u56e0\u4e3a\u52a0\u4e86\u7c7b\u6765\u7ba1\u7406\u8fd9\u4e2a\u6e38\u620f\uff0c\u6240\u4ee5\u4ee3\u7801\u6bd4\u8f83\u957f\uff0c\u4e3a\u4e86\u4fdd\u8bc1\u9605\u8bfb\u4f53\u9a8c\u6211\u653e\u6587\u672b\u4e86\u3002\u8dd1\u5230n=16\u7684\u65f6\u5019\uff0c\u7ed3\u679c\u4e3a\uff1a<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">[0] [] 1\r\n[1] [0] 2\r\n[2] [0, 0] 3\r\n[3] [0, 0, 0] 4\r\n[4] [0, 0, 1, 2] 6\r\n[5] [0, 0, 1, 2, 2] 9\r\n[6] [0, 0, 0, 1, 2, 2] 12\r\n[7] [0, 0, 1, 2, 1, 2, 2] 18\r\n[8] [0, 0, 1, 2, 2, 1, 2, 2] 27\r\n[9] [0, 0, 0, 1, 2, 2, 1, 2, 2] 36\r\n[10] [0, 0, 1, 2, 1, 2, 2, 1, 2, 2] 54\r\n[11] [0, 0, 1, 2, 2, 1, 2, 2, 1, 2, 2] 81\r\n[12] [0, 0, 0, 1, 2, 2, 1, 2, 2, 1, 2, 2] 108\r\n[13] [0, 0, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2] 162\r\n[14] [0, 0, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2] 243\r\n[15] [0, 0, 0, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2] 324\r\n[16] [0, 0, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2] 486<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5982\u679c\u80fd\u8fdb\u884c16\u6b21\u64cd\u4f5c\uff0c\u6700\u7ec8\u80fd\u6709486\u4e2a\"0\"\uff01\u800c\u4e14\u6700\u4f18\u89e3\u7684\u64cd\u4f5c\u4f3c\u4e4e\u524d2~3\u6b21\u662f[0]\u4e4b\u540e\u90fd\u662f[1,2,2]\u5faa\u73af\u3002\u89c4\u5f8b\u8bfb\u8005\u5e94\u8be5\u80fd\u81ea\u5df1\u5f52\u7eb3\u51fa\u6765\uff0c\u8fd9\u91cc\u5c31\u4e0d\u5199\u4e86\uff08\u53cd\u6b63\u5c31\u662f\u4e00\u5f00\u59cb[0,0]\uff0c\u7136\u540e\u4ece\u540e\u5f80\u524d\u5806[1,2,2]\uff0c\u7136\u540e\u8fd8\u5269\u4e0b\u4e00\u4e2a\u64cd\u4f5c\u4f4d\u7f6e\u5c31\u586b[0]\uff0c\u5269\u4e0b\u4fe9\u5c31\u586b[1,2]\uff09\u3002<\/p>\n<hr \/>\n<p>\u7a0b\u5e8f\u80fd\u5e2e\u6211\u4eec\u4e5f\u5c31\u90a3\u4e48\u591a\u4e86\uff0c\u81f3\u5c11\u6211\u4eec\u77e5\u9053\u6240\u6709\u4e00\u822c\u60c5\u51b5\u7684\u6700\u4f18\u89e3\u662f\u5565\u6837\u7684\u4e86\u3002\u53ef\u662f\u4e3a\u4ec0\u4e48\u5462\uff1f\u4e00\u5f00\u59cb\u7528[0]\u663e\u7136\u662f\u6700\u9ad8\u6548\u7684\uff0c\u4f46\u4e4b\u540e\u7684[1,2,2]\u4e3a\u5565\u662f\u6700\u9ad8\u6548\u7684\uff1f\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u662f[1,2,2,2]\uff0c\u4e5f\u4e0d\u662f[1,2]\uff08\u500d\u589e\uff09\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u6765\u8003\u8651\u4e00\u5f00\u59cb[0]\u6b21\u6570\u591a\u5c11\u7684\u95ee\u9898\u3002\u5176\u5b9e\u5728\u672c\u6587\u7684\u4e00\u5f00\u59cb\u5c31\u5df2\u7ecf\u57cb\u4e0b\u4f0f\u7b14\u4e86\u3002\u56e0\u4e3a\u5f88\u5bb9\u6613\u53d1\u73b0\u6700\u521d[0,0,0]\u7684\u6548\u7387\u548c[0,1,2]\u7684\u6548\u7387\u662f\u4e00\u6837\u7684\uff0c\u7ed3\u679c\u90fd\u662f4\u3002\u4ee5\u8fd9\u4e2a\u4e3a\u5206\u754c\u7ebf\uff0c\u5982\u679c[0]\u64cd\u4f5c\u6267\u884c\u4e24\u6b21\u548c[1,2]\u6bd4\u8f83\uff0c\u524d\u8005\u7ed3\u679c\u4e3a3\uff0c\u540e\u8005\u7ed3\u679c\u4e3a2\uff1b\u5982\u679c[0]\u64cd\u4f5c\u591a\u4f593\u6b21\uff0c\u90a3\u6548\u7387\u663e\u7136\u4e0d\u5982[1,2]\uff0c\u56e0\u4e3a\u8d77\u59cb\u503c\u8d85\u8fc73\u540e\u52a0\u4e8c\u80af\u5b9a\u6ca1\u6709\u500d\u589e\u6765\u5f97\u5feb\u3002\u6240\u4ee5\u4e00\u5f00\u59cb\u6267\u884c\u4e24\u6b21[0]\u52303\u7684\u6548\u7387\u662f\u6700\u9ad8\u7684\u3002<\/p>\n<p>\u90a3[1,2,2]\u4e3a\u5565\u5728\u4e4b\u540e\u5c40\u90e8\u6700\u9ad8\u6548\u5462\uff1f\u9996\u5148\uff0c\u6211\u4eec\u8981\u6e05\u695a\u4e00\u4ef6\u4e8b\u60c5\u3002[1]\u548c[2]\u5fc5\u7136\u662f[1]\u4e4b\u540e\u4e00\u4e32[2]\uff0c\u56e0\u4e3a\u91cd\u590d\u7684[1]\u64cd\u4f5c\u6ca1\u6709\u4efb\u4f55\u610f\u4e49\u3002\u90a3\u4e48\u6211\u4eec\u53ea\u9700\u8981\u6bd4\u8f83[1,2]\u548c[1,2,2]\u548c[1,2,2,....]\u7684\u6548\u7387\u5c31\u597d\u4e86\u3002\u6211\u4eec\u8bb0f(n)\u4e3a[1,(n-1)\u4e2a2]\u7684\u6548\u7387\uff0c\u5e76\u5b9a\u4e49[1,2]\u7684\u6548\u7387\u4e3a1\uff0c\u90a3\u4e48\u5f88\u5bb9\u6613\u5c31\u80fd\u7b97\u51fa\uff1af(2)=1 f(3)=9\/8 f(4)=16\/16 f(5)=25\/32...\u7528\u6570\u5b66\u5f52\u7eb3\u6cd5\u53ef\u4ee5\u63a8\u5bfc\u5e76\u8bc1\u660e\u51faf(n)=n^2\/2^n\u3002\u90a3\u8fd9\u4e2a\u6548\u7387\u51fd\u6570f(n)\u7684\u6700\u503c\u5728\u54ea\u91cc\uff0c\u8fd0\u7528\u6c42\u5bfc\u7684\u77e5\u8bc6\u4fbf\u53ef\u4ee5\u8bc1\u660e\u6c42\u51fa\u3002\u5f53\u7136\uff0c\u8fd9\u91cc\u662f\u79bb\u6563\u7684\uff0c\u4e5f\u5f88\u5bb9\u6613\u5c31\u80fd\u770b\u51fa\u4ecef(3)\u5f00\u59cb\u6548\u7387\u9012\u51cf\u3002\u56e0\u6b64,[1,2,2]\u7684\u6548\u7387\u6700\u9ad8\u3002<\/p>\n<p>\u4e4b\u540e\u4fbf\u662f\u5269\u4e0b\u4e00\u4e2a\u6216\u8005\u4e24\u4e2a\u64cd\u4f5c\u6b21\u6570\u7684\u65f6\u5019\u600e\u4e48\u529e\u7684\u95ee\u9898\u4e86\u3002\u5176\u5b9e\u8fd9\u4ec5\u5c40\u9650\u4e8e\u524d5\u6b65\uff0c\u679a\u4e3e\u8bc1\u660e\u6cd5\u5373\u53ef\u3002<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p>\u81f3\u6b64\uff0c\u8fd9\u4e2a\u56f0\u60d1\u4e86\u6211\u8bb8\u4e45\u7684\u7b80\u5355\u7684\u5c0f\u95ee\u9898\uff0c\u5c31\u5728\u8fd9\u4e2a\u5bd2\u5047\u88ab\u89e3\u51b3\u4e86\u3002\u4ee5\u4e0a\u4fbf\u662f\u7b14\u8005\u601d\u8003\u8fd9\u4e2a\u95ee\u9898\u65f6\u5019\u7684\u601d\u8def\u8fc7\u7a0b\uff0c\u8bb0\u5f55\u5728\u8fd9\u7bc7\u535a\u5ba2\u91cc\uff0c\u4ee5\u4f5c\u7559\u5ff5\u3002<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>\u8ba1\u7b97n\u6b21\u6700\u4f18\u89e3\u7684\u4ee3\u7801\uff1a\uff08\u5176\u4e2dGameManager\u662f\u53ef\u4ee5\u4e92\u52a8\u7740\u73a9\u7684\uff0cRobotPlay\u5c31\u662f\u673a\u5668\u66b4\u529b\u679a\u4e3e\uff0c\u6700\u7ec8\u53ea\u8f93\u51fa<strong>\u4e00\u79cd<\/strong>\u6700\u4f18\u89e3\uff09<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nclass GameManager:\r\n    def __init__(self,times=10):\r\n        self.timesbak=times\r\n        self.num=1\r\n        self.record=0\r\n        self.times=times\r\n        self.cmd=[self.add,self.rec,self.pas]\r\n\r\n    def rec(self):\r\n        self.record=self.num\r\n\r\n    def add(self):\r\n        self.num+=1\r\n\r\n    def pas(self):\r\n        self.num+=self.record\r\n\r\n    def info(self):\r\n        return (self.num,self.record,self.times)\r\n\r\n    def show(self):\r\n        print(&quot;\u76ee\u524d\u6570\u5b57 {0}\uff0c\u76ee\u524d\u8bb0\u5f55 {1}\uff0c\u5269\u4f59\u6b21\u6570 {2}&quot;.format(*self.info()))\r\n\r\n    def clear(self):\r\n        self.num=1\r\n        self.record=0\r\n        self.times=self.timesbak       \r\n\r\n    def run(self):\r\n        while(self.times&gt;0):\r\n            op=int(input(&quot;\\n[0]\u52a0\u4e00 [1]\u590d\u5236 [2]\u7c98\u8d34:&quot;))\r\n            self.cmd[op]()\r\n            self.times-=1\r\n            self.show()\r\n        print(&quot;-end-&quot;)\r\n\r\n\r\nclass RobotPlay(GameManager):\r\n\r\n    def toTri(self,num):\r\n        res=[0]*self.timesbak\r\n        now=num\r\n        for i in range(self.timesbak):\r\n            res[-i-1]=now%3\r\n            now=now\/\/3\r\n            if(now==0):\r\n                break\r\n        return res\r\n    \r\n    def run(self):\r\n        allres=[]\r\n        for i in range(3**self.times):\r\n            oplst=self.toTri(i)\r\n            for j in oplst:\r\n                self.cmd[j]()\r\n            #print(i+1,&quot;of&quot;,3**self.times,&quot;:&quot;,self.info()[0],sep=&quot;&quot;)\r\n            allres.append(self.info()[0])\r\n            self.clear()\r\n        print(&quot;[{0}]&quot;.format(self.timesbak),self.toTri(allres.index(max(allres))),max(allres))\r\n\r\nfor i in range(20):\r\n    _rbp=RobotPlay(i)\r\n    _rbp.run()\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u8fd9\u6837\u4e00\u4e2a\u6e38\u620f\uff1a \u6253\u5f00\u4f60\u7684\u8bb0\u4e8b\u672c\uff0c\u8f93\u5165\u4e00\u4e2a&#8221;0&#8243;\u3002 \u4f60\u670910\u6b21\u884c\u52a8\u56de\u5408 \u5728\u6bcf\u4e2a\u56de\u5408\u4e2d\uff0c\u4f60\u53ea\u80fd\uff1a\u2460\u518d\u8f93\u4e00\u4e2a&#8221;0&#8243; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,11],"tags":[],"views":3494,"_links":{"self":[{"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/posts\/194"}],"collection":[{"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":7,"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":202,"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/posts\/194\/revisions\/202"}],"wp:attachment":[{"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.4-xx.com\/index.php\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}