数学水题
推个公式或者找个规律就好了。。。
m^n-m*(m-1)^(n-1)
#include<bits/stdc++.h>
#define LL long long
#define mod 100003
using namespace std;
LL n,m;
LL ans;
LL ksm(LL A,LL B)
{
LL ans=1;
while(B)
{
if(B&1)ans=ans*A%mod;
B=B>>1;
A=A*A%mod;
}
return ans;
}
int main()
{
//freopen("a.in","r",stdin);
//freopen("a.out","w",stdout);
cin>>m>>n;
ans=ksm(m,n)-m%mod*ksm(m-1,n-1)%mod;
ans=(ans+mod)%mod;
cout<<ans;
return 0;
}