{"id":680,"date":"2013-02-16T05:34:36","date_gmt":"2013-02-15T21:34:36","guid":{"rendered":"http:\/\/www.shuizilong.com\/house\/?p=680"},"modified":"2013-02-16T06:11:16","modified_gmt":"2013-02-15T22:11:16","slug":"codeforces-round-166","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/codeforces-round-166\/","title":{"rendered":"Codeforces Round #166"},"content":{"rendered":"<p><!--more--><\/p>\n<h2>Problem A. Beautiful Year<\/h2>\n<h3>Brief description: <\/h3>\n<p>\u6c42\u6bd4 x \u5927\u7684\u7b2c\u4e00\u4e2a\u4e0d\u542b\u91cd\u590d\u6570\u5b57\u7684\u56db\u4f4d\u6570\u3002<\/p>\n<h2>Problem B. Prime Matrix<\/h2>\n<h3>Brief description: <\/h3>\n<p>\u7ed9\u4e2a 500 * 500 \u7684\u77e9\u9635\uff0c\u6bcf\u6b21\u64cd\u4f5c\u662f\u53ef\u4ee5\u628a\u4e00\u4e2a\u683c\u5b50 + 1\uff0c\u6700\u540e\u8981\u6c42\u6709\u4e00\u884c\u6216\u8005\u4e00\u5217\u90fd\u662f\u8d28\u6570\u5c31\u53ef\u4ee5\u3002\uff08\u6bcf\u4e2a\u6570 < 1e5...\n\uff08PS\uff1a\u5982\u679c\u6539\u6210\u4e00\u6b21\u628a\u4e00\u884c\u6216\u8005\u4e00\u5217 + 1 \u3002\u3002\u3002\u600e\u4e48\u505a\uff1f\u3002\u3002\n\n\n\n<h2>Problem C. Secret<\/h2>\n<h3>Brief description: <\/h3>\n<p>1~n \u5206\u6210 k \u4efd\uff0c\u4f7f\u5f97 k \u4efd\u90fd\u4e0d\u662f\u7b49\u5dee\u6570\u5217\u3002\u3002<br \/>\n\uff08\u3002\u30021-k 1-k k-1 1 1 1 1 1 1 1 \u3002\u3002\u3002\uff09<\/p>\n<h2>Problem D. Good Substrings<\/h2>\n<h3>Brief description: <\/h3>\n<p>\u3002\u3002\u7ed9\u5b9a\u4e00\u4e2a\u957f\u5ea6\u4e3a n \u5b57\u7b26\u4e32\u3002\u3002\u6bcf\u4e2a\u5b57\u7b26\u6709 \u597d\/\u574f \u4e24\u79cd\u5c5e\u6027\u3002\u3002\uff08 n <= 1,500\n\u4e00\u4e2a\u5b57\u4e32\u88ab\u79f0\u4e3a\u597d\u7684\u3002\u3002\u5982\u679c\u5176\u4e2d\u574f\u5b57\u7b26 <= k \u4e2a\u3002\u3002\u95ee\u4e0d\u540c\u7684\u597d\u5b50\u4e32\u6709\u591a\u5c11\u4e2a\u3002\u3002\n<a href=\"http:\/\/hi.baidu.com\/sillycross\/item\/386b1e172389391fb98a1ab1\">\u592a\u53ef\u6015\u4e86\u2026\u2026 \u5361\u6389\u5b57\u5178\u5e8fhash\u7684\u65b9\u6cd5 by xhr<\/a><\/p>\n<h2>Problem E. Three Horses<\/h2>\n<h3>Brief description: <\/h3>\n<p>\u3002\u4e09\u79cd\u64cd\u4f5c\u3002\u3002<\/p>\n<ul>\n<li>(a, b) -> (a+1, b+1) | \u5e73\u79fb\u3002\u3002<\/li>\n<li>(a, b) -> (a\/2, b\/2) | \u6298\u534a\u3002\u3002a, b is even <\/li>\n<li>(a, b), (b, c) -> (a, c) | \u8fde\u63a5\u3002\u3002<\/li>\n<\/ul>\n<p>\u3002\u3002\u95ee\u6709\u591a\u5c11\u521d\u59cb\u64cd\u4f5c (a, b)\uff0c\u6ee1\u8db3 1 <= a < b <= m\uff0c\u4f7f\u5f97\u53ef\u4ee5\u901a\u8fc7\u4e0a\u8ff0\u64cd\u4f5c\u751f\u6210\u3002\u3002\n\u3002\u3002(1, a1), (1, a2), ..., (1, an) \u8fd9\u4e9b\u4e8c\u5143\u7ec4\u3002\u3002\n\n\n\n<h3>Analysis: <\/h3>\n<p>\u8003\u5bdf\u64cd\u4f5c\u524d\u540e\u7684\u4e0d\u53d8\u91cf\u3002\u3002\u64cd\u4f5c 1 \u4e0d\u6539\u53d8\u5dee\u503c\u3002\u3002<br \/>\n\u64cd\u4f5c\u4e8c\u524d\u540e\u5dee\u503c \/2\u3002\u3002\u64cd\u4f5c\u4e09\u5dee\u503c\u652f\u6301\u76f8\u52a0\u3002\u3002<\/p>\n<p>\u3002\u3002\u56e0\u6b64\u82e5\u53ea\u6709 a1 \u65f6\u3002\u3002\u8bbe x = a1 -1 \u3002\u3002<br \/>\n\u5219\u6240\u6709\u53ef\u4ee5\u751f\u6210 x \u7684 d\u3002\u3002\u4e3a x \u7684\u6240\u6709\u7ea6\u6570\u7684 2 \u7684\u6574\u6b21\u5e42\u7684\u500d\u6570\u3002\u3002<br \/>\n\u3002\u3002\u679a\u4e3e\u6bcf\u4e2a\u7ea6\u6570\u3002\u3002\u7d2f\u8ba1 f(x) \u5373\u53ef\u3002\u3002<\/p>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\nLL f(int x){\r\n    if (!(x&amp;1)) return 0;\r\n    LL res = 0; for (int i=0;x&lt;&lt;i&lt;m;++i) res += m-(x&lt;&lt;i);\r\n    return res;\r\n}\r\n<\/pre>\n<p>\u3002\u3002\u591a\u4e2a ai \u3002\u3002\u3002\u5219\u5f00\u59cb\u9700\u8981\u5bf9\u4ed6\u4eec\u53d6 gcd \u3002\u3002\u3002<\/p>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n\/\/}\/* .................................................................................................................................. *\/\r\n\r\nint n, m;\r\n\r\nLL f(int x){\r\n    if (!(x&amp;1)) return 0;\r\n    LL res = 0; for (int i=0;x&lt;&lt;i&lt;m;++i) res += m-(x&lt;&lt;i);\r\n    return res;\r\n}\r\n\r\nint main(){\r\n\r\n#ifndef ONLINE_JUDGE\r\n    freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);\r\n    \/\/freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);\r\n#endif\r\n\r\n    RD(n, m); int d = 0; REP(i, n) d = __gcd(d, int(RD()-1));\r\n    int t = sqrt(d); LL res = t*t == d ? -f(t) : 0;\r\n    REP_1(i, t) if (d%i==0) res += f(i) + f(d\/i);\r\n\r\n\tOT(res);\r\n}\r\n<\/pre>\n<h3>External link: <\/h3>\n<p><a href=\"http:\/\/codeforces.com\/contest\/271\">http:\/\/codeforces.com\/contest\/271<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[18],"tags":[],"class_list":["post-680","post","type-post","status-publish","format-standard","hentry","category-codeforces"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-aY","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}