{"id":289,"date":"2016-11-28T14:28:47","date_gmt":"2016-11-28T06:28:47","guid":{"rendered":"http:\/\/kylelv.com\/?p=289"},"modified":"2017-12-20T19:31:42","modified_gmt":"2017-12-20T11:31:42","slug":"bzoj-1800-ahoi2009fly-%e9%a3%9e%e8%a1%8c%e6%a3%8b","status":"publish","type":"post","link":"https:\/\/blog.kylelv.com\/?p=289","title":{"rendered":"bzoj 1800: [Ahoi2009]fly \u98de\u884c\u68cb"},"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-69fdef5f668b0\" 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-69fdef5f668b0\"  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=289\/#1800_Ahoi2009fly_%E9%A3%9E%E8%A1%8C%E6%A3%8B\" title=\"1800: [Ahoi2009]fly \u98de\u884c\u68cb\">1800: [Ahoi2009]fly \u98de\u884c\u68cb<\/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=289\/#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=289\/#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=289\/#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=289\/#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=289\/#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=289\/#HINT\" title=\"HINT\">HINT<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blog.kylelv.com\/?p=289\/#Source\" title=\"Source\">Source<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"1800_Ahoi2009fly_%E9%A3%9E%E8%A1%8C%E6%A3%8B\"><\/span>1800: [Ahoi2009]fly \u98de\u884c\u68cb<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><\/center><center><span class=\"green\">Time Limit:\u00a010 Sec\u00a0\u00a0Memory Limit:\u00a064 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\">\u7ed9\u51fa\u5706\u5468\u4e0a\u7684\u82e5\u5e72\u4e2a\u70b9\uff0c\u5df2\u77e5\u70b9\u4e0e\u70b9\u4e4b\u95f4\u7684\u5f27\u957f\uff0c\u5176\u503c\u5747\u4e3a\u6b63\u6574\u6570\uff0c\u5e76\u4f9d\u5706\u5468\u987a\u5e8f\u6392\u5217\u3002 \u8bf7\u627e\u51fa\u8fd9\u4e9b\u70b9\u4e2d\u6709\u6ca1\u6709\u53ef\u4ee5\u56f4\u6210\u77e9\u5f62\u7684\uff0c\u5e76\u5e0c\u671b\u5728\u6700\u77ed\u65f6\u95f4\u5185\u627e\u51fa\u6240\u6709\u4e0d\u91cd\u590d\u77e9\u5f62\u3002<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Input\"><\/span>Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\u7b2c\u4e00\u884c\u4e3a\u6b63\u6574\u6570N\uff0c\u8868\u793a\u70b9\u7684\u4e2a\u6570\uff0c\u63a5\u4e0b\u6765N\u884c\u5206\u522b\u4e3a\u8fd9N\u4e2a\u70b9\u6240\u5206\u5272\u7684\u5404\u4e2a\u5706\u5f27\u957f\u5ea6<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Output\"><\/span>Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\u6240\u6784\u6210\u4e0d\u91cd\u590d\u77e9\u5f62\u7684\u4e2a\u6570<\/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\">8<br \/>\n1<br \/>\n2<br \/>\n2<br \/>\n3<br \/>\n1<br \/>\n1<br \/>\n3<br \/>\n3<\/p>\n<p><\/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\">3<br \/>\n<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"HINT\"><\/span>HINT<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>N&lt;= 20<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.lydsy.com\/JudgeOnline\/images\/1800.jpg\" alt=\"\" border=\"0\" \/><\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Source\"><\/span>Source<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:c++ decode:true \">#include&lt;cstdio&gt;\r\n#define F(i,l,r) for(int i=l;i&lt;=r;i++)\r\nint n,w[22],ans;\r\nint main()\r\n{\r\n    scanf(\"%d\",&amp;n);\r\n    w[0]=0;\r\n    F(i,1,n){\r\n        scanf(\"%d\",&amp;w[i]);\r\n        w[i]+=w[i-1];\r\n    }\r\n    if(w[n]&amp;1){printf(\"0\");return 0;}\r\n    F(i,1,n) F(j,i+1,n) if(w[j]-w[i]==w[n]&gt;&gt;1) ans++;\r\n    printf(\"%d\\n\",ans*(ans-1)&gt;&gt;1);\r\n    return 0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1800: [Ahoi2009]fly \u98de\u884c\u68cb Time Limit:\u00a010 Sec\u00a0\u00a0Memory Limi [&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-289","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\/289","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=289"}],"version-history":[{"count":1,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}