标签:cout geo ring noi pos long define hnoi2008 ref
思路:
越狱情况=总情况-不越狱情况;
代码:
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define ll long long ll poww(ll x,ll e,ll k) { ll res=1,pos=x;pos%=k; while(e) { if(e&1) res=(res*pos)%k; pos=(pos*pos)%k,e=e>>1; } return res; } int main() { ll m,n; cin>>m>>n; ll ans=(poww(m,n,100003)%100003-poww(m-1,n-1,100003)%100003*m%100003)%100003; cout<<(ans<0?ans+100003:ans); return 0; }
标签:cout geo ring noi pos long define hnoi2008 ref
原文地址:http://www.cnblogs.com/IUUUUUUUskyyy/p/6851880.html