{"id":175,"date":"2010-03-20T22:58:00","date_gmt":"2010-03-20T14:58:00","guid":{"rendered":"http:\/\/localhost\/?p=175"},"modified":"2010-03-20T22:58:00","modified_gmt":"2010-03-20T14:58:00","slug":"monkey_fights","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=175","title":{"rendered":"\u5c0f\u7334\u6253\u67b6"},"content":{"rendered":"\n<p>\u5c0f\u7334\u6253\u67b6<\/p>\n<p>Time Limit:5000MS&#160; Memory Limit:165536K<br \/>Total Submit:30 Accepted:22 <br \/>Case Time Limit:1000MS<\/p>\n<p><strong>Description <\/strong><\/p>\n<p>\u4e00\u5f00\u59cb\u68ee\u6797\u91cc\u9762\u6709N\u53ea\u4e92\u4e0d\u76f8\u8bc6\u7684\u5c0f\u7334\u5b50\uff0c\u5b83\u4eec\u7ecf\u5e38\u6253\u67b6\uff0c\u4f46\u6253\u67b6\u7684\u53cc\u65b9\u90fd\u5fc5\u987b\u4e0d\u662f\u597d\u670b\u53cb\u3002\u6bcf\u6b21\u6253\u5b8c\u67b6\u540e\uff0c\u6253\u67b6\u7684\u53cc\u65b9\u4ee5\u53ca\u5b83\u4eec\u7684\u597d\u670b\u53cb\u5c31\u4f1a\u4e92\u76f8\u8ba4\u8bc6\uff0c \u6210\u4e3a\u597d\u670b\u53cb\u3002\u7ecf\u8fc7N-1\u6b21\u6253\u67b6\u4e4b\u540e\uff0c\u6574\u4e2a\u68ee\u6797\u7684\u5c0f\u7334\u90fd\u4f1a\u6210\u4e3a\u597d\u670b\u53cb\u3002 <br \/>\u73b0\u5728\u7684\u95ee\u9898\u662f\uff0c\u603b\u5171\u6709\u591a\u5c11\u79cd\u4e0d\u540c\u7684\u6253\u67b6\u8fc7\u7a0b\u3002 <br \/>\u6bd4\u5982\u5f53N=3\u65f6\uff0c\u5c31\u6709{1-2,1-3}{1-2,2-3}{1-3,1-2}{1-3,2-3}{2-3,1-2}{2-3,1-3}\u516d\u79cd\u4e0d\u540c \u7684\u6253\u67b6\u8fc7\u7a0b\u3002 <\/p>\n<p><strong>Input <\/strong><\/p>\n<p> \u4e00\u4e2a\u6574\u6570N\u3002 <\/p>\n<p><strong>Output <\/strong><\/p>\n<p> \u4e00\u884c\uff0c\u65b9\u6848\u6570mod 9999991\u3002 <\/p>\n<p><strong>Sample Input <\/strong><\/p>\n<p>4<\/p>\n<p><strong>Sample Output <\/strong><\/p>\n<p>96<\/p>\n<p><strong>Hint <\/strong><\/p>\n<p> 50%\u7684\u6570\u636eN&lt;=10^3\u3002 <br \/>100%\u7684\u6570\u636eN&lt;=10^6\u3002 <\/p>\n<p><strong>Source <\/strong><\/p>\n<p><a target=\"_blank\" href=\"http:\/\/61.187.179.132:8080\/JudgeOnline\/showproblem?problem_id=1430\">61.187.179.132:8080\/JudgeOnline\/showproblem<\/a><br \/>\u989d\u3002\u9996\u5148\u4ed6\u4eec\u6253\u67b6\u7684\u5173\u7cfb\u662f\u4e00\u9897\u65e0\u6839\u6811\uff0c\u5c31\u6709n^(n-2)\u79cd\u60c5\u51b5\uff0c\u8fd8\u6709\u6253\u67b6\u7684\u987a\u5e8f\uff0c\u662f(n-1)!\u79cd\uff0c\u4e58\u8d77\u6765\u5c31\u53ef\u4ee5\u4e86\u56e7\u3002\u3002<br \/>Code:<br \/>#include&lt;iostream&gt;<br \/>#define rep(i,n) for(int i=0;i&lt;n;i++)<br \/>using namespace std;<br \/>const int inf=~0U&gt;&gt;1,mod=9999991;<br \/>int main()<br \/>{<br \/>    int n;long long ans=1;cin&gt;&gt;n;<br \/>    rep(i,n-2)ans*=n,ans%=mod;<br \/>    rep(i,n-1)ans*=i+1,ans%=mod;<br \/>    cout&lt;&lt;ans&lt;&lt;endl;<br \/>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u7334\u6253\u67b6 Time Limit:5000MS&#160; Memory Limit:165536KTotal Submit:30 Accepted:22 Case Time Limit:1000MS Description \u4e00\u5f00\u59cb\u68ee\u6797\u91cc\u9762\u6709N\u53ea\u4e92\u4e0d\u76f8\u8bc6\u7684\u5c0f\u7334\u5b50\uff0c\u5b83\u4eec\u7ecf\u5e38\u6253\u67b6\uff0c\u4f46\u6253\u67b6\u7684\u53cc\u65b9\u90fd\u5fc5\u987b\u4e0d\u662f\u597d\u670b\u53cb\u3002\u6bcf\u6b21\u6253\u5b8c\u67b6\u540e\uff0c\u6253\u67b6\u7684\u53cc\u65b9\u4ee5\u53ca\u5b83\u4eec\u7684\u597d\u670b\u53cb\u5c31\u4f1a\u4e92\u76f8\u8ba4\u8bc6\uff0c \u6210\u4e3a\u597d\u670b\u53cb\u3002\u7ecf\u8fc7N-1\u6b21\u6253\u67b6\u4e4b\u540e\uff0c\u6574\u4e2a\u68ee\u6797\u7684\u5c0f\u7334\u90fd\u4f1a\u6210\u4e3a\u597d\u670b\u53cb\u3002 \u73b0\u5728\u7684\u95ee\u9898\u662f\uff0c\u603b\u5171\u6709\u591a\u5c11\u79cd\u4e0d\u540c\u7684\u6253\u67b6\u8fc7\u7a0b\u3002 \u6bd4\u5982\u5f53N=3\u65f6\uff0c\u5c31\u6709{1-2,1-3}{1-2,2-3}{1-3,1-2}{1-3,2-3}{2-3,1-2}{2-3,1-3}\u516d\u79cd\u4e0d\u540c \u7684\u6253\u67b6\u8fc7\u7a0b\u3002 Input \u4e00\u4e2a\u6574\u6570N\u3002 Output \u4e00\u884c\uff0c\u65b9\u6848\u6570mod 9999991\u3002 Sample Input 4 Sample Output 96 Hint 50%\u7684\u6570\u636eN&lt;=10^3\u3002 100%\u7684\u6570\u636eN&lt;=10^6\u3002 Source 61.187.179.132:8080\/JudgeOnline\/showproblem\u989d\u3002\u9996\u5148\u4ed6\u4eec\u6253\u67b6\u7684\u5173\u7cfb\u662f\u4e00\u9897\u65e0\u6839\u6811\uff0c\u5c31\u6709n^(n-2)\u79cd\u60c5\u51b5\uff0c\u8fd8\u6709\u6253\u67b6\u7684\u987a\u5e8f\uff0c\u662f(n-1)!\u79cd\uff0c\u4e58\u8d77\u6765\u5c31\u53ef\u4ee5\u4e86\u56e7\u3002\u3002Code:#include&lt;iostream&gt;#define rep(i,n) for(int i=0;i&lt;n;i++)using namespace std;const int inf=~0U&gt;&gt;1,mod=9999991;int main(){ int n;long long ans=1;cin&gt;&gt;n; rep(i,n-2)ans*=n,ans%=mod; rep(i,n-1)ans*=i+1,ans%=mod; cout&lt;&lt;ans&lt;&lt;endl;}<\/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\/175"}],"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=175"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/175\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}