我是专业做水题的。
#include<cstdio> long long n,m; long long ksm(long long a,long long b){ long long base=a%100003,ans=1; while(b){ if(b%2)ans=(ans*base)%100003; base=(base*base)%100003; b/=2; } return ans; } int main(){ freopen("1008.in","r",stdin); freopen("1008.out","w",stdout); scanf("%lld %lld",&m,&n); long long df=(ksm(m,n)-m*ksm(m-1,n-1))%100003; printf("%lld\n",df<0?df+100003:df); return 0; }