{"id":311,"date":"2016-11-28T19:34:18","date_gmt":"2016-11-28T11:34:18","guid":{"rendered":"http:\/\/kylelv.com\/?p=311"},"modified":"2017-12-22T19:55:41","modified_gmt":"2017-12-22T11:55:41","slug":"bzoj-2295-%e3%80%90poj-challenge%e3%80%91%e6%88%91%e7%88%b1%e4%bd%a0%e5%95%8a","status":"publish","type":"post","link":"https:\/\/blog.kylelv.com\/?p=311","title":{"rendered":"bzoj 2295: \u3010POJ Challenge\u3011\u6211\u7231\u4f60\u554a"},"content":{"rendered":"<p><center><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69fdef89241ad\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69fdef89241ad\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.kylelv.com\/?p=311\/#2295_%E3%80%90POJ_Challenge%E3%80%91%E6%88%91%E7%88%B1%E4%BD%A0%E5%95%8A\" title=\"2295: \u3010POJ Challenge\u3011\u6211\u7231\u4f60\u554a\">2295: \u3010POJ Challenge\u3011\u6211\u7231\u4f60\u554a<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.kylelv.com\/?p=311\/#Description\" title=\"Description\">Description<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.kylelv.com\/?p=311\/#Input\" title=\"Input\">Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.kylelv.com\/?p=311\/#Output\" title=\"Output\">Output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blog.kylelv.com\/?p=311\/#Sample_Input\" title=\"Sample Input\">Sample Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blog.kylelv.com\/?p=311\/#Sample_Output\" title=\"Sample Output\">Sample Output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blog.kylelv.com\/?p=311\/#HINT\" title=\"HINT\">HINT<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"2295_%E3%80%90POJ_Challenge%E3%80%91%E6%88%91%E7%88%B1%E4%BD%A0%E5%95%8A\"><\/span>2295: \u3010POJ Challenge\u3011\u6211\u7231\u4f60\u554a<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span class=\"green\">Time Limit:\u00a01 Sec\u00a0\u00a0Memory Limit:\u00a0128 MB<\/span><\/center><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Description\"><\/span>Description<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>&nbsp;<\/p>\n<p>ftiasch\u662f\u4e2a\u5341\u5206\u53d7\u5973\u751f\u6b22\u8fce\u7684\u540c\u5b66\uff0c\u6240\u4ee5\u5979\u603b\u662f\u6536\u5230\u8bb8\u591a\u60c5\u4e66\u3002\u867d\u7136\u5979\u5341\u5206\u6709\u9b45\u529b\uff0c\u7136\u800c\u5979\u5374\u662f\u4e2a\u4f4e\u8c03\u7684\u4eba\u3002\u56e0\u6b64\u5979\u4ece\u6765\u4e0d\u4f1a\u544a\u8bc9\u522b\u4eba\u5979\u5230\u5e95\u6536\u5230\u4e86\u591a\u5c11\u60c5\u4e66\u3002<\/p>\n<p>ftiasch\u7684\u597d\u670b\u53cb1tthinking\u60f3\u77e5\u9053\u5979\u5230\u5e95\u6536\u5230\u4e86\u591a\u5c11\u60c5\u4e66\u30021tthinking\u77e5\u9053\uff0cftiasch\u6bcf\u6b21\u6536\u5230\u4e00\u5c01\u60c5\u4e66\uff0c\u5c31\u4f1a\u5728\u65e5\u8bb0\u6700\u540e\u5199\u4e0b\u4e00\u4e2a\u5305\u542b&#8221;luvletter&#8221;\u5b50\u5e8f\u5217\u7684\u4e32\u3002\u6bd4\u5982\u73b0\u5728ftiasch\u7684\u65e5\u8bb0\u662falduddvdletterflusvletetedr\uff0c\u90a3\u4e48ftiasch\u53ef\u80fd\u53d7\u5230\u4e860\u30011\u30012\u5c01\u60c5\u4e66\u3002\u73b0\u5728\u7ed9\u51fa\u4e00\u4e9bftiasch\u7684\u65e5\u8bb0\uff0c\u95ee\u5bf9\u4e8e\u6bcf\u7bc7\u65e5\u8bb0\uff0cftiasch\u6700\u591a\u53ef\u80fd\u53d7\u5230\u591a\u5c11\u7684\u60c5\u4e66\u3002<\/p>\n<p>\u67d0\u4e2a\u5e8f\u5217\u7684\u5b50\u5e8f\u5217\u662f\u4ece\u6700\u521d\u5e8f\u5217\u901a\u8fc7\u53bb\u9664\u67d0\u4e9b\u5143\u7d20\u4f46\u4e0d\u7834\u574f\u9980\u4e0b\u5143\u7d20\u7684\u76f8\u5bf9\u4f4d\u7f6e\u800c\u5f62\u6210\u7684\u65b0\u5e8f\u5217\u3002<a href=\"http:\/\/en.wikipedia.org\/wiki\/Subsequence\" target=\"_blank\" rel=\"noopener\">\u53c3\u8003wikipedia<\/a>\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/media.openjudge.cn\/images\/g3205_1.jpg\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Input\"><\/span>Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>&nbsp;<\/p>\n<p>\u7b2c1\u884c\uff0c\u4e00\u4e2a\u6574\u6570\u00a0<em>T<\/em>\u00a0(0 \u2264\u00a0<em>T<\/em>\u00a0\u2264 100), \u65e5\u8bb0\u7684\u6570\u91cf\u3002\u7b2c2\u5230\u00a0<em>T<\/em>\u00a0+ 1\u884c\uff0cftiasch\u7684\u65e5\u8bb0 (\u53ea\u5305\u542b&#8217;a&#8217;-&#8216;z&#8217; \u548c\u7a7a\u683c, \u957f\u5ea6\u5c0f\u4e8e100001)<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Output\"><\/span>Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>&nbsp;<\/p>\n<p>\u7b2c1\u5230T\u884c\uff0c\u4e00\u4e2a\u6574\u6570, \u6700\u5927\u53ef\u80fd\u7684\u60c5\u4e66\u6570\u91cf\u3002&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Input\"><\/span>Sample Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">5<br \/>\nt<br \/>\nllllluvletterrr<br \/>\nluvletterlauavalaeatataearaluvletter<br \/>\nis wzk a famous boy yes buz he always receives a lot of luv letters<br \/>\nmy heart beats her waves at the shore of the world and writes upon it her signature in tears with the words i love thee<br \/>\n<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Output\"><\/span>Sample Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">0<br \/>\n1<br \/>\n3<br \/>\n1<br \/>\n0<br \/>\n<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"HINT\"><\/span>HINT<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:c++ decode:true \">#include&lt;cstdio&gt;\r\n#include&lt;string&gt;\r\n#include&lt;cstring&gt;\r\n#include&lt;algorithm&gt;\r\nchar s[100010],t[]=\"luvletter\";\r\nint n,l,j,ans;\r\nint main()\r\n{\r\n    scanf(\"%d\\n\",&amp;n);\r\n    while(n--)\r\n    {\r\n        gets(s);\r\n        l=strlen(s);\r\n        ans=j=0;\r\n        for(int i=0;i&lt;l;i++)\r\n        {\r\n            if(s[i]==t[j]) j++;\r\n            if(j==9) j=0,ans++;\r\n        }\r\n        printf(\"%d\\n\",ans);\r\n    }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2295: \u3010POJ Challenge\u3011\u6211\u7231\u4f60\u554a Time Limit:\u00a01 Sec\u00a0\u00a0Memory Lim [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[16],"class_list":["post-311","post","type-post","status-publish","format-standard","hentry","category-bzoj","tag-16"],"_links":{"self":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311"}],"version-history":[{"count":1,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/311\/revisions"}],"predecessor-version":[{"id":312,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/311\/revisions\/312"}],"wp:attachment":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}