{"id":325,"date":"2018-11-04T01:24:11","date_gmt":"2018-11-03T17:24:11","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=325"},"modified":"2018-11-04T01:24:11","modified_gmt":"2018-11-03T17:24:11","slug":"sp7586-numofpal","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2018\/11\/04\/sp7586-numofpal\/","title":{"rendered":"sp7586 NUMOFPAL"},"content":{"rendered":"<p>\u6c42\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u56de\u6587\u5b50\u4e32\u4e2a\u6570\u3002<br \/>\n\u51e1\u662f\u8fd9\u7c7b\u95ee\u9898\uff0c\u4f18\u5148\u8003\u8651\u9ebb\u8fa3\u70eb\u3002<br \/>\n\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\uff0c\u4f9d\u636e\u9898\u610f\uff0c\u4efb\u610f\u4e24\u4e2a\u5bf9\u79f0\u8f74\u4e0d\u540c\u7684\u56de\u6587\u4e32\uff0c\u90fd\u662f\u300c\u672c\u8d28\u4e0d\u540c\u300d\u7684\u3002<br \/>\n\u5e76\u4e14\uff0c\u6bcf\u4e2a\u56de\u6587\u4e32\uff0c\u548c\u5b83\u5bf9\u79f0\u8f74\u76f8\u540c\u7684\u6240\u6709\u5b50\u4e32\u90fd\u5fc5\u7136\u662f\u56de\u6587\u4e32\u3002<br \/>\n\u6545\u800c\u6211\u4eec\u5148\u7528\u9ebb\u8fa3\u70eb\u5904\u7406\uff0c\u7136\u540e\u7edf\u8ba1\u4e00\u904d\u5373\u53ef\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"cpp\">#include&lt;iostream&gt;\r\n#include&lt;cstdio&gt;\r\n#include&lt;cstring&gt;\r\nusing namespace std;\r\n#define Max(_A,_B) ((_A)&gt;(_B)?(_A):(_B))\r\n#define Min(_A,_B) ((_A)&lt;(_B)?(_A):(_B))\r\nint n,f[200005];\r\nchar ch[100005],s[200005];\r\ninline void manacher(){\r\n\tint mx=0,nw;\r\n\tfor(int i=2;i&lt;=n;++i){\r\n\t\tif(i&lt;mx){\r\n\t\t\tf[i]=Min(f[(nw&lt;&lt;1)-i],f[nw]-(i-nw));\r\n\t\t}else{\r\n\t\t\tf[i]=1;\r\n\t\t}\r\n\t\twhile(s[i+f[i]]==s[i-f[i]]){\r\n\t\t\t++f[i];\r\n\t\t}\r\n\t\tif(i+f[i]&gt;mx){\r\n\t\t\tmx=i+f[i];\r\n\t\t\tnw=i;\r\n\t\t}\r\n\t}\r\n}\r\nvoid init(){\r\n\tcin&gt;&gt;(ch+1);\r\n\tn=strlen(ch+1);\r\n\ts[1]=s[2]='#';\r\n\tfor(int i=1;i&lt;=n;++i){\r\n\t\ts[(i&lt;&lt;1)+1]=ch[i];\r\n\t\ts[(i&lt;&lt;1)+2]='#';\r\n\t}\r\n\tn=(n&lt;&lt;1)+2;\r\n\ts[n+1]=0;\r\n\tmanacher();\r\n\tint ans=0;\r\n\tfor(int i=1;i&lt;=n;++i){\r\n\t\tans+=f[i]\/2;\r\n\t} \r\n\tprintf(\"%d\\n\",ans);\r\n}\r\nint main(){\r\n\tinit();\r\n\treturn 0;\r\n}<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6c42\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u56de\u6587\u5b50\u4e32\u4e2a\u6570\u3002 \u51e1\u662f\u8fd9\u7c7b\u95ee\u9898\uff0c\u4f18\u5148\u8003\u8651\u9ebb\u8fa3\u70eb\u3002 \u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\uff0c\u4f9d\u636e\u9898\u610f\uff0c\u4efb\u610f\u4e24\u4e2a\u5bf9\u79f0\u8f74\u4e0d\u540c\u7684\u56de\u6587 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/SmokeyDays.top\/wordpress\/2018\/11\/04\/sp7586-numofpal\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201csp7586 NUMOFPAL\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,40,6,5,41],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/325"}],"collection":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/comments?post=325"}],"version-history":[{"count":1,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/325\/revisions"}],"predecessor-version":[{"id":326,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/325\/revisions\/326"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=325"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}