{"id":151,"date":"2010-03-13T12:47:00","date_gmt":"2010-03-13T04:47:00","guid":{"rendered":"http:\/\/localhost\/?p=151"},"modified":"2010-03-13T12:47:00","modified_gmt":"2010-03-13T04:47:00","slug":"zjoi2008_birthday_party_party","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=151","title":{"rendered":"[ZJOI2008]\u751f\u65e5\u805a\u4f1aParty"},"content":{"rendered":"\n<p>[ZJOI2008]\u751f\u65e5\u805a\u4f1aParty<\/p>\n<p>Time Limit:10000MS&#160; Memory Limit:165536K<br \/>Total Submit:35 Accepted:20 <br \/>Case Time Limit:1000MS<\/p>\n<p><strong>Description <\/strong><\/p>\n<p>\u4eca\u5929\u662fhidadz\u5c0f\u670b\u53cb\u7684\u751f\u65e5\uff0c\u5979\u9080\u8bf7\u4e86\u8bb8\u591a\u670b\u53cb\u6765\u53c2\u52a0\u5979\u7684\u751f\u65e5party\u3002  hidadz\u5e26\u7740\u670b\u53cb\u4eec\u6765\u5230\u82b1\u56ed\u4e2d\uff0c\u6253\u7b97\u5750\u6210\u4e00\u6392\u73a9\u6e38\u620f\u3002\u4e3a\u4e86\u6e38\u620f\u4e0d\u81f3\u4e8e\u65e0\u804a\uff0c\u5c31\u5ea7\u7684\u65b9\u6848\u5e94\u6ee1\u8db3\u5982\u4e0b\u6761\u4ef6\uff1a <br \/>\u5bf9\u4e8e\u4efb\u610f\u8fde\u7eed\u7684\u4e00\u6bb5\uff0c\u7537\u5b69\u4e0e\u5973\u5b69\u7684\u6570\u76ee\u4e4b\u5dee\u4e0d\u8d85\u8fc7k\u3002 <br \/>\u5f88\u5feb\uff0c\u5c0f\u670b\u53cb\u4fbf\u627e\u5230\u4e86\u4e00\u79cd\u65b9\u6848\u5750\u4e86\u4e0b\u6765\u5f00\u59cb\u6e38\u620f\u3002hidadz\u7684\u597d\u670b\u53cbSusie\u53d1\u73b0\uff0c\u8fd9\u6837\u7684\u5c31\u5ea7\u65b9\u6848\u5176\u5b9e\u662f\u5f88\u591a\u7684\uff0c\u6240\u4ee5\u5927\u5bb6\u5f88\u5feb\u5c31\u627e\u5230\u4e86\u4e00\u79cd\uff0c \u90a3\u4e48\u5230\u5e95\u6709\u591a\u5c11\u79cd\u5462\uff1f\u70ed\u7231\u6570\u5b66\u7684hidadz\u548c\u5979\u7684\u670b\u53cb\u4eec\u5f00\u59cb\u601d\u8003\u8fd9\u4e2a\u95ee\u9898\u2026\u2026 <br \/>\u5047\u8bbe\u53c2\u52a0party\u7684\u4eba\u4e2d\u5171\u6709n\u4e2a\u7537\u5b69\u4e0em\u4e2a\u5973\u5b69\uff0c\u4f60\u662f\u5426\u80fd\u89e3\u7b54Susie\u548chidadz\u7684\u7591\u95ee\u5462\uff1f\u7531\u4e8e\u8fd9\u4e2a\u6570\u76ee\u53ef\u80fd\u5f88\u591a\uff0c\u4ed6\u4eec\u53ea\u60f3\u77e5\u9053\u8fd9\u4e2a\u6570\u76ee \u9664\u4ee512345678\u7684\u4f59\u6570\u3002 <\/p>\n<p><strong>Input <\/strong><\/p>\n<p> \u4ec5\u5305\u542b\u4e00\u884c\u51713\u4e2a\u6574\u6570\uff0c\u5206\u522b\u4e3a\u7537\u5b69\u6570\u76een, \u5973\u5b69\u6570\u76eem,  \u5e38\u6570k\u3002 <\/p>\n<p><strong>Output <\/strong><\/p>\n<p> \u5e94\u5305\u542b\u4e00\u884c\uff0c\u4e3a\u9898\u4e2d\u8981\u6c42\u7684\u7b54\u6848\u3002 <\/p>\n<p><strong>Sample Input <\/strong><\/p>\n<p>1 2 1<\/p>\n<p><strong>Sample Output <\/strong><\/p>\n<p>1<\/p>\n<p><strong>Hint <\/strong><\/p>\n<p> \u5bf9\u4e8e30%\u7684\u6570\u636e\uff0cn , m \u2264 20\uff1b <br \/>\u5bf9\u4e8e100%\u7684\u6570\u636e, n , m \u2264 150\uff0ck \u2264 20\u3002 <\/p>\n<p><strong>Source <\/strong><\/p>\n<p><a href=\"http:\/\/61.187.179.132:8080\/JudgeOnline\/showproblem?problem_id=1037\" target=\"_blank\">61.187.179.132:8080\/JudgeOnline\/showproblem<\/a><br \/>\u989d\u3002\u5c31\u662fDP\u4e0d\u77e5\u9053\u6709\u6ca1\u6709\u4ec0\u4e48\u516c\u5f0f\u7684\u3002<br \/>\u8bbedp(i,j,k1,k2)\u662f\u6709i\u4e2a\u4eba\uff0cj\u4e2a\u7537\u7684\uff0c\u53f3\u7aef\u6700\u591a\u7537\u751f\u6bd4\u5973\u751f\u591ak1\u4e2a\uff0c\u6700\u591a\u5973\u751f\u6bd4\u7537\u751f\u591ak2\u4e2a\uff0c<br \/>\u8ddf\u7b97\u6700\u5927\u8fde\u7eed\u5b50\u5e8f\u5217\u7684\u7ebf\u6bb5\u6811\u5dee\u4e0d\u591a\u3002\u3002<br \/>\u7136\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5DP\u4e86\u3002\u3002\u7531\u4e8e\u7a7a\u95f4\u4e0d\u591f\uff0c\u8981\u7528\u6eda\u52a8\u6570\u7ec4\u989d\u3002<br \/>Code\uff1a<br \/>#include&lt;cstdio&gt;<br \/>#include&lt;iostream&gt;<br \/>#include&lt;algorithm&gt;<br \/>#include&lt;string&gt;<br \/>#include&lt;vector&gt;<br \/>#include&lt;cstring&gt;<br \/>#define rep(i,n) for(int i=0;i&lt;n;i++)<br \/>#define pb push_back<br \/>using namespace std;<br \/>const int inf=~0U&gt;&gt;1,maxn=150+1,maxk=20+1,mod=12345678;<br \/>int n,m,k;<br \/>int dp[2][maxn][maxk][maxk];<br \/>void add(int&amp;a,int x)<br \/>{<br \/>    a+=x;a%=mod;<br \/>}<br \/>int main()<br \/>{<br \/>    \/\/freopen(&quot;in&quot;,&quot;r&quot;,stdin);<br \/>    cin&gt;&gt;n&gt;&gt;m&gt;&gt;k;<br \/>    int now=0,old=1;<br \/>    dp[now][0][0][0]=1;<br \/>    for(int i=0;i&lt;n+m;++i)<br \/>    {<br \/>        swap(now,old);<br \/>        memset(dp[now],0,sizeof(dp[now]));<br \/>        for(int j=0;j&lt;=min(i,n);++j)<br \/>            for(int k1=0;k1&lt;=min(j,k);++k1)<br \/>                for(int k2=0;k2&lt;=min(i-j,k);++k2)<br \/>                {<br \/>                    int x=dp[old][j][k1][k2];<br \/>                    if(k1&lt;k&amp;&amp;j&lt;n) add(dp[now][j+1][k1+1][max(k2-1,0)],x);<br \/>                    if(k2&lt;k&amp;&amp;i-j&lt;m) add(dp[now][j][max(k1-1,0)][k2+1],x);<br \/>                }<br \/>    }<br \/>    int ans=0;<br \/>    rep(k1,k+1)rep(k2,k+1) ans+=dp[now][n][k1][k2],ans%=mod;<br \/>    cout&lt;&lt;ans&lt;&lt;endl;<br \/>} <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ZJOI2008]\u751f\u65e5\u805a\u4f1aParty Time Limit:10000MS&#160; Memory Limit:165536KTotal Submit:35 Accepted:20 Case Time Limit:1000MS Description \u4eca\u5929\u662fhidadz\u5c0f\u670b\u53cb\u7684\u751f\u65e5\uff0c\u5979\u9080\u8bf7\u4e86\u8bb8\u591a\u670b\u53cb\u6765\u53c2\u52a0\u5979\u7684\u751f\u65e5party\u3002 hidadz\u5e26\u7740\u670b\u53cb\u4eec\u6765\u5230\u82b1\u56ed\u4e2d\uff0c\u6253\u7b97\u5750\u6210\u4e00\u6392\u73a9\u6e38\u620f\u3002\u4e3a\u4e86\u6e38\u620f\u4e0d\u81f3\u4e8e\u65e0\u804a\uff0c\u5c31\u5ea7\u7684\u65b9\u6848\u5e94\u6ee1\u8db3\u5982\u4e0b\u6761\u4ef6\uff1a \u5bf9\u4e8e\u4efb\u610f\u8fde\u7eed\u7684\u4e00\u6bb5\uff0c\u7537\u5b69\u4e0e\u5973\u5b69\u7684\u6570\u76ee\u4e4b\u5dee\u4e0d\u8d85\u8fc7k\u3002 \u5f88\u5feb\uff0c\u5c0f\u670b\u53cb\u4fbf\u627e\u5230\u4e86\u4e00\u79cd\u65b9\u6848\u5750\u4e86\u4e0b\u6765\u5f00\u59cb\u6e38\u620f\u3002hidadz\u7684\u597d\u670b\u53cbSusie\u53d1\u73b0\uff0c\u8fd9\u6837\u7684\u5c31\u5ea7\u65b9\u6848\u5176\u5b9e\u662f\u5f88\u591a\u7684\uff0c\u6240\u4ee5\u5927\u5bb6\u5f88\u5feb\u5c31\u627e\u5230\u4e86\u4e00\u79cd\uff0c \u90a3\u4e48\u5230\u5e95\u6709\u591a\u5c11\u79cd\u5462\uff1f\u70ed\u7231\u6570\u5b66\u7684hidadz\u548c\u5979\u7684\u670b\u53cb\u4eec\u5f00\u59cb\u601d\u8003\u8fd9\u4e2a\u95ee\u9898\u2026\u2026 \u5047\u8bbe\u53c2\u52a0party\u7684\u4eba\u4e2d\u5171\u6709n\u4e2a\u7537\u5b69\u4e0em\u4e2a\u5973\u5b69\uff0c\u4f60\u662f\u5426\u80fd\u89e3\u7b54Susie\u548chidadz\u7684\u7591\u95ee\u5462\uff1f\u7531\u4e8e\u8fd9\u4e2a\u6570\u76ee\u53ef\u80fd\u5f88\u591a\uff0c\u4ed6\u4eec\u53ea\u60f3\u77e5\u9053\u8fd9\u4e2a\u6570\u76ee \u9664\u4ee512345678\u7684\u4f59\u6570\u3002 Input \u4ec5\u5305\u542b\u4e00\u884c\u51713\u4e2a\u6574\u6570\uff0c\u5206\u522b\u4e3a\u7537\u5b69\u6570\u76een, \u5973\u5b69\u6570\u76eem, \u5e38\u6570k\u3002 Output \u5e94\u5305\u542b\u4e00\u884c\uff0c\u4e3a\u9898\u4e2d\u8981\u6c42\u7684\u7b54\u6848\u3002 Sample Input 1 2 1 Sample Output 1 Hint \u5bf9\u4e8e30%\u7684\u6570\u636e\uff0cn , m \u2264 20\uff1b \u5bf9\u4e8e100%\u7684\u6570\u636e, n , m \u2264 150\uff0ck \u2264 20\u3002 Source 61.187.179.132:8080\/JudgeOnline\/showproblem\u989d\u3002\u5c31\u662fDP\u4e0d\u77e5\u9053\u6709\u6ca1\u6709\u4ec0\u4e48\u516c\u5f0f\u7684\u3002\u8bbedp(i,j,k1,k2)\u662f\u6709i\u4e2a\u4eba\uff0cj\u4e2a\u7537\u7684\uff0c\u53f3\u7aef\u6700\u591a\u7537\u751f\u6bd4\u5973\u751f\u591ak1\u4e2a\uff0c\u6700\u591a\u5973\u751f\u6bd4\u7537\u751f\u591ak2\u4e2a\uff0c\u8ddf\u7b97\u6700\u5927\u8fde\u7eed\u5b50\u5e8f\u5217\u7684\u7ebf\u6bb5\u6811\u5dee\u4e0d\u591a\u3002\u3002\u7136\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5DP\u4e86\u3002\u3002\u7531\u4e8e\u7a7a\u95f4\u4e0d\u591f\uff0c\u8981\u7528\u6eda\u52a8\u6570\u7ec4\u989d\u3002Code\uff1a#include&lt;cstdio&gt;#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;string&gt;#include&lt;vector&gt;#include&lt;cstring&gt;#define rep(i,n) for(int i=0;i&lt;n;i++)#define pb push_backusing namespace std;const [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/151"}],"collection":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=151"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/151\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}