2 10 1 10 2
55 385
AC码:
#include<stdio.h> #define N 10003 int main() { long long T,n,p,i,b,t,a,sum; // 必须用long long scanf("%d",&T); while(T--) { scanf("%lld%lld",&n,&p); if(n==0) // md,坑爹,题目明明n是大于0的 { // 但没有这个条件,就是不通过!!! printf("0\n"); continue; } sum=1; for(i=2;i<=n;i++) { a=i; b=p; t=1; while(b) { if(b&1) t=(t*a)%N; a=(a*a)%N; b=b/2; } sum=(sum+t)%N; } printf("%d\n",sum); } return 0; }
English learning method ---音标学习的瓶颈,布布扣,bubuko.com
English learning method ---音标学习的瓶颈
原文地址:http://blog.csdn.net/mazhaojuan/article/details/25739615