{"id":134,"date":"2010-02-27T13:23:00","date_gmt":"2010-02-27T05:23:00","guid":{"rendered":"http:\/\/localhost\/?p=134"},"modified":"2010-02-27T13:23:00","modified_gmt":"2010-02-27T05:23:00","slug":"hnoi2008_jailbreak","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=134","title":{"rendered":"[HNOI2008]\u8d8a\u72f1"},"content":{"rendered":"<p> \u5012\u3002\u3002\u8fd9\u4e48\u6c34\u7684\u9898\u76ee\u90fd\u6709\u7684\u3002\u3002<br \/>Link\uff1a<a href=\"http:\/\/61.187.179.132:8080\/JudgeOnline\/showproblem?problem_id=1008\" target=\"_blank\">61.187.179.132:8080\/JudgeOnline\/showproblem<\/a><br \/>\u6b63\u7740\u60f3\u6709\u70b9\u9ebb\u70e6\u3002\u3002\u5012\u8fc7\u6765\u60f3\u3002\u3002<br \/>\u4e00\u5171\u6709m^n\u79cd\u60c5\u51b5\uff0c\u5176\u4e2d\u4e0d\u80fd\u8d8a\u72f1\u7684\u60c5\u51b5\u4e2d\uff0c\u5982\u679c\u4ece\u5de6\u5f80\u53f3\u8003\u8651\u7684\u8bdd\uff0c\u7b2c\u4e00\u4e2a\u662fm\u79cd\uff0c\u5176\u4f59\u90fd\u662fm-1\u79cd<br \/>\u6240\u4ee5\u5c31\u662f(m-1)^(n-1)*m\u3002\u3002\u7528\u4e00\u4e2a\u4e8c\u5206\u8ba1\u7b97\u4e58\u65b9\u5c31\u53ef\u4ee5\u4e86\u3002\u3002<br \/>\u51cf\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u56e7\u3002\u3002<br \/>Code\uff1a<\/p>\n<p>#include&lt;iostream&gt;<br \/>using namespace std;<br \/>typedef long long ll;<br \/>const int mod=100003;<br \/>ll m,n;<br \/>inline void mul(ll&amp;a,int b){a*=b;a%=mod;}<br \/>int power(ll x,int base)<br \/>{<br \/>    if(x==0) return 1;<br \/>    ll tmp=power(x\/2,base);<br \/>    mul(tmp,tmp);<br \/>    if(x&amp;1) mul(tmp,base);<br \/>    return tmp;<br \/>}<br \/>int main()<br \/>{<br \/>    cin&gt;&gt;m&gt;&gt;n;<br \/>    int all=power(n,m);<br \/>    ll sub=power(n-1,m-1);<br \/>    mul(sub,m);<br \/>    int ans=all-sub;if(ans&lt;0) ans+=mod;<br \/>    cout&lt;&lt;ans&lt;&lt;endl;<br \/>}<br \/>\u672c\u9ad8\u4eae\u4ee3\u7801\u4f7f\u7528codeHl\u751f\u6210\uff0c   <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5012\u3002\u3002\u8fd9\u4e48\u6c34\u7684\u9898\u76ee\u90fd\u6709\u7684\u3002\u3002Link\uff1a61.187.179.132:8080\/JudgeOnline\/showproblem\u6b63\u7740\u60f3\u6709\u70b9\u9ebb\u70e6\u3002\u3002\u5012\u8fc7\u6765\u60f3\u3002\u3002\u4e00\u5171\u6709m^n\u79cd\u60c5\u51b5\uff0c\u5176\u4e2d\u4e0d\u80fd\u8d8a\u72f1\u7684\u60c5\u51b5\u4e2d\uff0c\u5982\u679c\u4ece\u5de6\u5f80\u53f3\u8003\u8651\u7684\u8bdd\uff0c\u7b2c\u4e00\u4e2a\u662fm\u79cd\uff0c\u5176\u4f59\u90fd\u662fm-1\u79cd\u6240\u4ee5\u5c31\u662f(m-1)^(n-1)*m\u3002\u3002\u7528\u4e00\u4e2a\u4e8c\u5206\u8ba1\u7b97\u4e58\u65b9\u5c31\u53ef\u4ee5\u4e86\u3002\u3002\u51cf\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u56e7\u3002\u3002Code\uff1a #include&lt;iostream&gt;using namespace std;typedef long long ll;const int mod=100003;ll m,n;inline void mul(ll&amp;a,int b){a*=b;a%=mod;}int power(ll x,int base){ if(x==0) return 1; ll tmp=power(x\/2,base); mul(tmp,tmp); if(x&amp;1) mul(tmp,base); return tmp;}int main(){ cin&gt;&gt;m&gt;&gt;n; int all=power(n,m); ll sub=power(n-1,m-1); mul(sub,m); int ans=all-sub;if(ans&lt;0) ans+=mod; cout&lt;&lt;ans&lt;&lt;endl;}\u672c\u9ad8\u4eae\u4ee3\u7801\u4f7f\u7528codeHl\u751f\u6210\uff0c<\/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\/134"}],"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=134"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}