{"id":250,"date":"2012-11-09T10:03:00","date_gmt":"2012-11-09T02:03:00","guid":{"rendered":"http:\/\/nike0good.jp1.rpvhost.net\/155"},"modified":"2012-11-09T10:03:00","modified_gmt":"2012-11-09T02:03:00","slug":"the_lucky_string_ansistring","status":"publish","type":"post","link":"https:\/\/nike0good.com\/?p=250","title":{"rendered":"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring)"},"content":{"rendered":"<p align=\"center\">\u5e78\u8fd0\u5b57\u7b26\u4e32(string)<\/p>\n<p align=\"left\">\u3010\u95ee\u9898\u63cf\u8ff0\u3011<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u53ea\u5305\u542b0\u548c1\u7684\u5b57\u7b26\u4e32\uff0c\u5982\u679cA\u662f\u5e78\u8fd0\u7684\uff0cB\u4e5f\u662f\u5e78\u8fd0\u7684\uff0c\u90a3\u4e481AB1\u4e5f\u662f\u4e00\u4e2a\u5e78\u8fd0\u7684\u4e32\u3002\u73b0\u5728\u5b9a\u4e49\u201d0\u201d\u662f\u4e00\u4e2a\u5e78\u8fd0\u5b57\u7b26\u4e32\uff0c\u8bf7\u5224\u65ad\u7ed9\u5b9a\u7684\u5b57\u7b26\u4e32S\u662f\u5426\u662f\u5e78\u8fd0\u7684\u3002<\/p>\n<p>\u3010\u8f93\u5165&#26684;\u5f0f\u3011<\/p>\n<p><span style=\"color:windowtext\">\u7b2c\u4e00\u884c\u4e00\u4e2a\u6570\u5b57<\/span><span style=\"color:windowtext\">T<\/span><span style=\"color:windowtext\">\uff0c\u8868\u793a\u6570\u636e\u7ec4\u6570\u3002<\/span><\/p>\n<p><span style=\"color:windowtext\">\u63a5\u4e0b\u6765<\/span><span style=\"color:windowtext\">T<\/span><span style=\"color:windowtext\">\u7ec4\u6570\u636e\uff0c\u7b2c\u4e00\u884c\u5b57\u7b26\u4e32\u957f\u5ea6<\/span><span style=\"color:windowtext\">n<\/span><span style=\"color:windowtext\">\uff0c\u63a5\u4e0b\u6765\u4e00\u884c\u4e00\u4e2a\u53ea\u542b<\/span><span style=\"color:windowtext\">01<\/span><span style=\"color:windowtext\">\u7684\u5b57\u7b26\u4e32\u3002<\/span><\/p>\n<p>\u3010\u8f93\u51fa&#26684;\u5f0f\u3011<\/p>\n<p>T\u884c\uff0c\u7b2ci\u4e2a\u4e32\u5982\u679c\u662f\u5e78\u8fd0\u5b57\u7b26\u4e32\u90a3\u4e48\u8f93\u51fa\u201dYES\u201d\uff0c\u5426\u5219\u8f93\u51fa\u201dNO\u201d\u3002<\/p>\n<p>\u3010\u6837\u4f8b\u8f93\u5165\u3011<\/p>\n<p>3<\/p>\n<p>4<\/p>\n<p>1001<\/p>\n<p>7<\/p>\n<p>1100101<\/p>\n<p>7<\/p>\n<p>0110011<\/p>\n<p>\u3010\u6837\u4f8b\u8f93\u51fa\u3011<\/p>\n<p>YES<\/p>\n<p>YES<\/p>\n<p>NO<\/p>\n<p>\u3010\u6570\u636e\u8303\u56f4\u3011<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 30%\u7684\u6570\u636e\u6ee1\u8db3n&lt;=100\uff1b<\/p>\n<p>50%\u7684\u6570\u636e\u6ee1\u8db3n&lt;=300\uff1b<\/p>\n<p>100%\u7684\u6570\u636e\u6ee1\u8db3n&lt;=800\uff0cT&lt;=10<\/p>\n<p>&nbsp;<\/p>\n<p>\u672a1A\u7684\u539f\u56e0\uff0c\u53c8\u6ca1\u6539ansistring<\/p>\n<p>\n<\/p>\n<p><pre name=\"code\" class=\"delphi\">\/\/string\nvar\n   n,tt,i,j,now:longint;\n   s:ansistring;\nfunction sort(i,j:longint):boolean;\nvar\n   k:longint;\nbegin\n\n\n\n\n\n\n\n   if (i=j) then\n   begin\n      if s[i]='0' then exit(true)\n      else exit(false);\n   end;\n {\n   if (s[i]='1') and (s[j]='1') then\n   begin\n      for k:=i+1 to j-2 do\n         if (sort(i+1,k)) and (sort(k+1,j-1)) then exit(true);\n\n   end;\n }\n   exit(false);\n\n\nend;\nbegin\n   assign(input,'string.in');\n   assign(output,'string.out');\n   reset(input);\n   rewrite(output);\n   readln(tt);\n   while (tt&gt;0) do\n   begin\n      readln(n);\n      readln(s);\n      while (true) do\n      begin\n         i:=pos('1001',s);\n         if (i=0) then break;\n         delete(s,i,2);\n         delete(s,i+1,1);\n         dec(n,3);\n      end;\n\n\n\n\n\n      if (sort(1,n)) then writeln('YES')\n      else writeln('NO');\n\n      dec(tt);\n   end;\n   close(input);\n   close(output);\nend.\n<\/pre>\n<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5e78\u8fd0\u5b57\u7b26\u4e32(string) \u3010\u95ee\u9898\u63cf\u8ff0\u3011 \u5bf9\u4e8e\u4e00\u4e2a\u53ea\u5305\u542b0\u548c1\u7684\u5b57\u7b26\u4e32\uff0c\u5982\u679cA\u662f\u5e78\u8fd0\u7684\uff0cB\u4e5f\u662f\u5e78\u8fd0\u7684\uff0c\u90a3\u4e481A [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[3],"tags":[71],"class_list":["post-250","post","type-post","status-publish","format-standard","hentry","category-defaultcategory","tag-string_handling"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring) - nike0good<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nike0good.com\/?p=250\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring) - nike0good\" \/>\n<meta property=\"og:description\" content=\"\u5e78\u8fd0\u5b57\u7b26\u4e32(string) \u3010\u95ee\u9898\u63cf\u8ff0\u3011 \u5bf9\u4e8e\u4e00\u4e2a\u53ea\u5305\u542b0\u548c1\u7684\u5b57\u7b26\u4e32\uff0c\u5982\u679cA\u662f\u5e78\u8fd0\u7684\uff0cB\u4e5f\u662f\u5e78\u8fd0\u7684\uff0c\u90a3\u4e481A [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nike0good.com\/?p=250\" \/>\n<meta property=\"og:site_name\" content=\"nike0good\" \/>\n<meta property=\"article:published_time\" content=\"2012-11-09T02:03:00+00:00\" \/>\n<meta name=\"author\" content=\"nike0good\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"nike0good\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=250#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=250\"},\"author\":{\"name\":\"nike0good\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"headline\":\"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring)\",\"datePublished\":\"2012-11-09T02:03:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=250\"},\"wordCount\":32,\"commentCount\":0,\"keywords\":[\"\u5b57\u7b26\u4e32\u5904\u7406\"],\"articleSection\":[\"DefaultCategory\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=250#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=250\",\"url\":\"https:\\\/\\\/nike0good.com\\\/?p=250\",\"name\":\"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring) - nike0good\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\"},\"datePublished\":\"2012-11-09T02:03:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=250#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=250\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=250#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nike0good.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\",\"url\":\"https:\\\/\\\/nike0good.com\\\/\",\"name\":\"nike0good\",\"description\":\"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nike0good.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\",\"name\":\"nike0good\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"caption\":\"nike0good\"},\"sameAs\":[\"https:\\\/\\\/nike0good.com\"],\"url\":\"https:\\\/\\\/nike0good.com\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring) - nike0good","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nike0good.com\/?p=250","og_locale":"zh_CN","og_type":"article","og_title":"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring) - nike0good","og_description":"\u5e78\u8fd0\u5b57\u7b26\u4e32(string) \u3010\u95ee\u9898\u63cf\u8ff0\u3011 \u5bf9\u4e8e\u4e00\u4e2a\u53ea\u5305\u542b0\u548c1\u7684\u5b57\u7b26\u4e32\uff0c\u5982\u679cA\u662f\u5e78\u8fd0\u7684\uff0cB\u4e5f\u662f\u5e78\u8fd0\u7684\uff0c\u90a3\u4e481A [&hellip;]","og_url":"https:\/\/nike0good.com\/?p=250","og_site_name":"nike0good","article_published_time":"2012-11-09T02:03:00+00:00","author":"nike0good","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"nike0good","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nike0good.com\/?p=250#article","isPartOf":{"@id":"https:\/\/nike0good.com\/?p=250"},"author":{"name":"nike0good","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"headline":"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring)","datePublished":"2012-11-09T02:03:00+00:00","mainEntityOfPage":{"@id":"https:\/\/nike0good.com\/?p=250"},"wordCount":32,"commentCount":0,"keywords":["\u5b57\u7b26\u4e32\u5904\u7406"],"articleSection":["DefaultCategory"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nike0good.com\/?p=250#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nike0good.com\/?p=250","url":"https:\/\/nike0good.com\/?p=250","name":"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring) - nike0good","isPartOf":{"@id":"https:\/\/nike0good.com\/#website"},"datePublished":"2012-11-09T02:03:00+00:00","author":{"@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"breadcrumb":{"@id":"https:\/\/nike0good.com\/?p=250#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nike0good.com\/?p=250"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nike0good.com\/?p=250#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nike0good.com\/"},{"@type":"ListItem","position":2,"name":"\u5e78\u8fd0\u5b57\u7b26\u4e32(ansistring)"}]},{"@type":"WebSite","@id":"https:\/\/nike0good.com\/#website","url":"https:\/\/nike0good.com\/","name":"nike0good","description":"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nike0good.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad","name":"nike0good","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","caption":"nike0good"},"sameAs":["https:\/\/nike0good.com"],"url":"https:\/\/nike0good.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=250"}],"version-history":[{"count":0,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/250\/revisions"}],"wp:attachment":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}