标签:style class blog code http tar
数学题,推出公式就好了!
//Accepted 804 KB 0 ms #include <cstdio> #include <cstring> const long long pp = 100003; long long pow(long long a,long long b) { if (b==0) return 1; if (b==1) return a%pp; long long ans=pow(a,b/2); if (b%2==0) ans=ans*ans%pp; else ans=ans*ans%pp*(a%pp)%pp; return ans; } long long n,m; int main() { while (scanf("%lld%lld",&m,&n)!=EOF) { long long ans=pow(m,n)-m%pp*pow(m-1,n-1)%pp; if (ans<0) ans+=pp; printf("%lld\n",ans); } return 0; }
标签:style class blog code http tar
原文地址:http://www.cnblogs.com/djingjing/p/3790760.html