|
人见人爱A^B
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 40 Accepted Submission(s) : 26Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Description求A^B的最后三位数表示的整数。
说明:A^B的含义是“A的B次方” Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。
Output对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。
Sample Input2 3
12 6
6789 10000
0 0
Sample Output8
984
1
AuthorSourceACM程序设计期末考试(2006/06/07)
代码:
#include<stdio.h>
int main() {long m,n,i,t; while(scanf("%ld%ld",&m,&n)!=EOF) { if(m==0&&n==0) break; else if(n==0) t=1;
else if(m==0) t=0; else for(i=1,t=1;i<=n;i++) t=t*m%1000; printf("%ld\n",t);
}
} |
HDU 2035 人见人爱A^B
最新推荐文章于 2022-09-08 10:47:47 发布
1728

被折叠的 条评论
为什么被折叠?



