{"id":134,"date":"2011-08-20T23:21:22","date_gmt":"2011-08-20T15:21:22","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=134"},"modified":"2020-06-03T23:22:02","modified_gmt":"2020-06-03T15:22:02","slug":"poj-1579-function-run-fun","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=134","title":{"rendered":"poj 1579 Function Run Fun"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\/*\n\u7528\u5230\u4e86dp\u4e2d\u8bb0\u5fc6\u5316\u641c\u7d22\u7684\u601d\u60f3\n\u586b\u8868\u8bb0\u5f55\u6765\u51cf\u5c11\u9012\u5f52\u65f6\u7684\u91cd\u590d\u8c03\u7528 \n*\/\n#define LOCAL\n#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;cmath>\n#include&lt;cstring>\n#include&lt;cstdlib>\n#include&lt;iomanip>\n#include&lt;string>\n#include&lt;algorithm>\n#include&lt;ctime>\n#include&lt;stack>\n#include&lt;queue>\n#include&lt;vector>\n#define N 25\nusing namespace std;\nint map&#91;N]&#91;N]&#91;N];\nint w(int a,int b,int c)\n{\n           if(a&lt;=0||b&lt;=0||c&lt;=0) return map&#91;0]&#91;0]&#91;0]=1;\n           if(a>20||b>20||c>20) return map&#91;20]&#91;20]&#91;20]=1048576;\n           if(map&#91;a]&#91;b]&#91;c]) return map&#91;a]&#91;b]&#91;c];\n           if(a&lt;b&amp;&amp;b&lt;c){return map&#91;a]&#91;b]&#91;c]=w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c);}\n           return map&#91;a]&#91;b]&#91;c]=w(a-1,b,c)+w(a-1,b-1,c)+w(a-1,b,c-1)-w(a-1,b-1,c-1);  \n}\nint main()\n{\n#ifdef LOCAL\n       freopen(\"input.txt\",\"r\",stdin);\n       freopen(\"output.txt\",\"w\",stdout);\n#endif\n \n        int x,y,z;\n        memset(map,0,sizeof(map));\n        while(cin>>x>>y>>z&amp;&amp;(!(x==-1&amp;&amp;y==-1&amp;&amp;z==-1)))\n            printf(\"w(%d, %d, %d) = %d\\n\",x,y,z,w(x,y,z));       \n        return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-06-01-acm"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=134"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}