{"id":253,"date":"2016-11-21T19:18:24","date_gmt":"2016-11-21T11:18:24","guid":{"rendered":"http:\/\/kylelv.com\/?p=253"},"modified":"2017-12-13T13:07:54","modified_gmt":"2017-12-13T05:07:54","slug":"noip-2016%e6%8f%90%e9%ab%98%e7%bb%84d2t1-problem","status":"publish","type":"post","link":"https:\/\/blog.kylelv.com\/?p=253","title":{"rendered":"noip 2016\u63d0\u9ad8\u7ec4D2T1 problem"},"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-69fdef4054944\" 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-69fdef4054944\"  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=253\/#NOIP2016%E7%BB%84%E5%90%88%E6%95%B0%E9%97%AE%E9%A2%98_D2_T1\" title=\"[NOIP2016]\u7ec4\u5408\u6570\u95ee\u9898 D2 T1\">[NOIP2016]\u7ec4\u5408\u6570\u95ee\u9898 D2 T1<\/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=253\/#%E9%A2%98%E7%9B%AE%E6%8F%8F%E8%BF%B0\" title=\"\u9898\u76ee\u63cf\u8ff0\">\u9898\u76ee\u63cf\u8ff0<\/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=253\/#%E8%BE%93%E5%85%A5\" title=\"\u8f93\u5165\">\u8f93\u5165<\/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=253\/#%E8%BE%93%E5%87%BA\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/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=253\/#%E6%A0%B7%E4%BE%8B%E8%BE%93%E5%85%A5\" title=\"\u6837\u4f8b\u8f93\u5165\">\u6837\u4f8b\u8f93\u5165<\/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=253\/#%E6%A0%B7%E4%BE%8B%E8%BE%93%E5%87%BA\" title=\"\u6837\u4f8b\u8f93\u51fa\">\u6837\u4f8b\u8f93\u51fa<\/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=253\/#%E6%8F%90%E7%A4%BA\" title=\"\u63d0\u793a\">\u63d0\u793a<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"NOIP2016%E7%BB%84%E5%90%88%E6%95%B0%E9%97%AE%E9%A2%98_D2_T1\"><\/span>[NOIP2016]\u7ec4\u5408\u6570\u95ee\u9898 D2 T1<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span class=\"green\">\u65f6\u95f4\u9650\u5236:\u00a01 Sec\u00a0\u00a0\u5185\u5b58\u9650\u5236:\u00a0512 MB<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E9%A2%98%E7%9B%AE%E6%8F%8F%E8%BF%B0\"><\/span>\u9898\u76ee\u63cf\u8ff0<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>\u7ec4\u5408\u6570<span class=\"math-tex\"><span class=\"MathJax_Preview\"><span id=\"MathJax-Element-1-Frame\" class=\"MathJax_SVG\" style=\"margin: 0px; padding: 0px; line-height: 1.5;\" data-mathml=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msubsup&gt;&lt;mi&gt;C&lt;\/mi&gt;&lt;mi&gt;n&lt;\/mi&gt;&lt;mi&gt;m&lt;\/mi&gt;&lt;\/msubsup&gt;&lt;\/math&gt;\"><span class=\"MJX_Assistive_MathML\">Cnm\u8868\u793a\u7684\u662f\u4ecen\u4e2a\u7269\u54c1\u4e2d\u9009\u51fam\u4e2a\u7269\u54c1\u7684\u65b9\u6848\u6570\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4ece\uff081,2,3) \u4e09\u4e2a\u7269\u54c1\u4e2d\u9009\u62e9\u4e24\u4e2a\u7269\u54c1\u53ef\u4ee5\u6709\uff081,2),(1,3),(2,3)\u8fd9\u4e09\u79cd\u9009\u62e9\u65b9\u6cd5\u3002\u6839\u636e\u7ec4\u5408\u6570\u7684\u5b9a\u4e49\uff0c\u6211\u4eec\u53ef\u4ee5\u7ed9\u51fa\u8ba1\u7b97\u7ec4\u5408\u6570\u7684\u4e00\u822c\u516c\u5f0f\uff1a<\/span><\/span><\/span><\/span><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/images2015.cnblogs.com\/blog\/1014417\/201611\/1014417-20161121190239315-383816607.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u5176\u4e2dn! = 1 \u00d7 2 \u00d7 \u00b7 \u00b7 \u00b7 \u00d7 n<\/p>\n<p>\u5c0f\u5b81\u60f3\u77e5\u9053\u5982\u679c\u7ed9\u5b9an,m\u548ck\uff0c\u5bf9\u4e8e\u6240\u6709\u76840 &lt;= i &lt;= n\uff0c0 &lt;= j &lt;= min(i,m)\u6709\u591a\u5c11\u5bf9 (i,j)\u6ee1\u8db3<span class=\"math-tex\"><span class=\"MathJax_Preview\"><span id=\"MathJax-Element-3-Frame\" class=\"MathJax_SVG\" style=\"margin: 0px; padding: 0px; line-height: 1.5;\" data-mathml=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msubsup&gt;&lt;mi&gt;C&lt;\/mi&gt;&lt;mi&gt;i&lt;\/mi&gt;&lt;mi&gt;j&lt;\/mi&gt;&lt;\/msubsup&gt;&lt;\/math&gt;\"><span class=\"MJX_Assistive_MathML\">Cij\u662fk\u7684\u500d\u6570\u3002<\/span><\/span><\/span><\/span><\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E8%BE%93%E5%85%A5\"><\/span>\u8f93\u5165<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>\u7b2c\u4e00\u884c\u6709\u4e24\u4e2a\u6574\u6570t,k\uff0c\u5176\u4e2dt\u4ee3\u8868\u8be5\u6d4b\u8bd5\u70b9\u603b\u5171\u6709\u591a\u5c11\u7ec4\u6d4b\u8bd5\u6570\u636e\uff0ck\u7684\u610f\u4e49\u89c1 \u3010\u95ee\u9898\u63cf\u8ff0\u3011\u3002<\/p>\n<p>\u63a5\u4e0b\u6765t\u884c\u6bcf\u884c\u4e24\u4e2a\u6574\u6570n,m\uff0c\u5176\u4e2dn,m\u7684\u610f\u4e49\u89c1\u3010\u95ee\u9898\u63cf\u8ff0\u3011\u3002<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E8%BE%93%E5%87%BA\"><\/span>\u8f93\u51fa<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>t\u884c\uff0c\u6bcf\u884c\u4e00\u4e2a\u6574\u6570\u4ee3\u8868\u7b54\u6848\u3002<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E6%A0%B7%E4%BE%8B%E8%BE%93%E5%85%A5\"><\/span>\u6837\u4f8b\u8f93\u5165<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">1 2 3 3<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E6%A0%B7%E4%BE%8B%E8%BE%93%E5%87%BA\"><\/span>\u6837\u4f8b\u8f93\u51fa<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">1<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E6%8F%90%E7%A4%BA\"><\/span>\u63d0\u793a<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>&nbsp;<\/p>\n<p>\u3010\u6837\u4f8b\u89e3\u91ca\u3011<br \/>\n\u5728\u6240\u6709\u53ef\u80fd\u7684\u60c5\u51b5\u4e2d\uff0c\u53ea\u6709<span class=\"math-tex\"><span class=\"MathJax_Preview\"><span id=\"MathJax-Element-4-Frame\" class=\"MathJax_SVG\" style=\"margin: 0px; padding: 0px; line-height: 1.5;\" data-mathml=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot;&gt;&lt;msubsup&gt;&lt;mi&gt;C&lt;\/mi&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;mn&gt;1&lt;\/mn&gt;&lt;\/msubsup&gt;&lt;mo&gt;=&lt;\/mo&gt;&lt;mn&gt;2&lt;\/mn&gt;&lt;\/math&gt;\"><span class=\"MJX_Assistive_MathML\">C21=2\u662f2\u7684\u500d\u6570\u3002<\/span><\/span><\/span><\/span><\/p>\n<p>\u3010\u5b50\u4efb\u52a1\u3011<br \/>\n<img decoding=\"async\" src=\"http:\/\/images2015.cnblogs.com\/blog\/1014417\/201611\/1014417-20161122132810221-699289546.png\" alt=\"\" \/><\/p>\n<pre class=\"lang:c++ decode:true \">#include&lt;cstdio&gt;\r\nint n,m,k,T,c[2010][2010],ji[2010][2010];\r\nint main()\r\n{\r\n    scanf(\"%d%d\",&amp;T,&amp;k);\r\n    for(int i=0;i&lt;=2000;i++) c[i][0]=1;\r\n    for(int i=1;i&lt;=2000;i++)\r\n    for(int j=1;j&lt;=i;j++)\r\n        c[i][j]=(c[i-1][j]+c[i-1][j-1])%k;\r\n    c[0][0]=1;\r\n    for(int i=1;i&lt;=2000;i++)\r\n    {\r\n        for(int j=1;j&lt;=i;j++)\r\n        {\r\n            ji[i][j]=ji[i-1][j]+ji[i][j-1]-ji[i-1][j-1];\r\n            if(c[i][j]==0) ji[i][j]++;\r\n        }\r\n        for(int j=i+1;j&lt;=2000;j++) ji[i][j]=ji[i][i];\r\n    }\r\n    while(T--)\r\n    {\r\n        scanf(\"%d%d\",&amp;n,&amp;m);\r\n        printf(\"%d\\n\",ji[n][m]);\r\n    }\r\n    return 0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; [NOIP2016]\u7ec4\u5408\u6570\u95ee\u9898 D2 T1 \u65f6\u95f4\u9650\u5236:\u00a01 Sec\u00a0\u00a0\u5185\u5b58\u9650\u5236:\u00a0512 MB  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,8],"class_list":["post-253","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-dp","tag-8"],"_links":{"self":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/253","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=253"}],"version-history":[{"count":2,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/253\/revisions"}],"predecessor-version":[{"id":255,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/253\/revisions\/255"}],"wp:attachment":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}