{"id":372,"date":"2017-02-28T11:09:10","date_gmt":"2017-02-28T03:09:10","guid":{"rendered":"http:\/\/kylelv.com\/?p=372"},"modified":"2017-12-28T14:43:42","modified_gmt":"2017-12-28T06:43:42","slug":"bzoj-2190-sdoi2008%e4%bb%aa%e4%bb%97%e9%98%9f-%e6%ac%a7%e6%8b%89%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/blog.kylelv.com\/?p=372","title":{"rendered":"bzoj 2190: [SDOI2008]\u4eea\u4ed7\u961f  &#8212; \u6b27\u62c9\u51fd\u6570"},"content":{"rendered":"<p>&nbsp;<\/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-69fdeefda44d4\" 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-69fdeefda44d4\"  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=372\/#2190_SDOI2008%E4%BB%AA%E4%BB%97%E9%98%9F\" title=\"2190: [SDOI2008]\u4eea\u4ed7\u961f\">2190: [SDOI2008]\u4eea\u4ed7\u961f<\/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=372\/#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=372\/#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=372\/#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=372\/#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=372\/#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=372\/#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=372\/#Source\" title=\"Source\">Source<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"2190_SDOI2008%E4%BB%AA%E4%BB%97%E9%98%9F\"><\/span>2190: [SDOI2008]\u4eea\u4ed7\u961f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: center;\"><span class=\"green\">Time Limit:\u00a010 Sec\u00a0\u00a0Memory Limit:\u00a0259 MB<\/span><\/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>\u3000\u3000\u4f5c\u4e3a\u4f53\u80b2\u59d4\u5458\uff0cC\u541b\u8d1f\u8d23\u8fd9\u6b21\u8fd0\u52a8\u4f1a\u4eea\u4ed7\u961f\u7684\u8bad\u7ec3\u3002\u4eea\u4ed7\u961f\u662f\u7531\u5b66\u751f\u7ec4\u6210\u7684N * N\u7684\u65b9\u9635\uff0c\u4e3a\u4e86\u4fdd\u8bc1\u961f\u4f0d\u5728\u884c\u8fdb\u4e2d\u6574\u9f50\u5212\u4e00\uff0cC\u541b\u4f1a\u8ddf\u5728\u4eea\u4ed7\u961f\u7684\u5de6\u540e\u65b9\uff0c\u6839\u636e\u5176\u89c6\u7ebf\u6240\u53ca\u7684\u5b66\u751f\u4eba\u6570\u6765\u5224\u65ad\u961f\u4f0d\u662f\u5426\u6574\u9f50(\u5982\u4e0b\u56fe)\u3002 \u3000\u3000\u00a0<img decoding=\"async\" src=\"http:\/\/www.lydsy.com\/JudgeOnline\/images\/2190.jpg\" alt=\"\" border=\"0\" \/>\u00a0\u3000\u3000\u73b0\u5728\uff0cC\u541b\u5e0c\u671b\u4f60\u544a\u8bc9\u4ed6\u961f\u4f0d\u6574\u9f50\u65f6\u80fd\u770b\u5230\u7684\u5b66\u751f\u4eba\u6570\u3002<\/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>\u3000\u3000\u5171\u4e00\u4e2a\u6570N\u3002<\/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>\u3000\u3000\u5171\u4e00\u4e2a\u6570\uff0c\u5373C\u541b\u5e94\u770b\u5230\u7684\u5b66\u751f\u4eba\u6570\u3002<\/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\">\n<p><span class=\"sampledata\">\u3000\u30004<\/span><\/p>\n<p>&nbsp;<\/p>\n<\/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\">\n<p><span class=\"sampledata\">\u3000\u30009<\/span><\/p>\n<p>&nbsp;<\/p>\n<\/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>&nbsp;<\/p>\n<p>\u3010\u6570\u636e\u89c4\u6a21\u548c\u7ea6\u5b9a\u3011 \u3000\u3000\u5bf9\u4e8e 100% \u7684\u6570\u636e\uff0c1 \u2264 N \u2264 40000<\/p>\n<p>&nbsp;<\/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 N 40060\r\nint n,eul[N],pri[N&gt;&gt;2],cnt,t,ans=1;\r\nbool vs[N];\r\nint main()\r\n{\r\n    scanf(\"%d\",&amp;n);\r\n    eul[1]=1;\r\n    for(int i=2;i&lt;n;i++)\r\n    {\r\n        if(!vs[i])\r\n        {\r\n            pri[++cnt]=i;\r\n            eul[i]=i-1;\r\n        }\r\n        for(int j=1;j&lt;=cnt;j++)\r\n        {\r\n            t=i*pri[j];\r\n            if(t&gt;n) break;\r\n            vs[t]=1;\r\n            if(i%pri[j]==0){eul[t]=eul[i]*pri[j];break;}\r\n            else eul[t]=eul[i]*(pri[j]-1);\r\n        }\r\n        ans+=eul[i];\r\n    }\r\n    printf(\"%d\\n\",ans&lt;&lt;1|1);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; 2190: [SDOI2008]\u4eea\u4ed7\u961f Time Limit:\u00a010 Sec\u00a0\u00a0Memory L [&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":[8,34],"class_list":["post-372","post","type-post","status-publish","format-standard","hentry","category-bzoj","tag-8","tag-34"],"_links":{"self":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/372","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=372"}],"version-history":[{"count":2,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions"}],"predecessor-version":[{"id":374,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions\/374"}],"wp:attachment":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}