[plain] #include <stdio.h>
int main()
{
int i;
int n;
int m;
int sum;
while(scanf("%d %d", &n, &m)!=EOF && (n!=0 || m!=0))
{
sum=1;
for(i=1; i<=m; i++)
{
sum=((n%1000)*sum)%1000;
}
printf("%d\n", sum);
}
return 0;
}
#include <stdio.h>
int main()
{
int i;
int n;
int m;
int sum;
while(scanf("%d %d", &n, &m)!=EOF && (n!=0 || m!=0))
{
sum=1;
for(i=1; i<=m; i++)
{
sum=((n%1000)*sum)%1000;
}
printf("%d\n", sum);
}
return 0;
}
結果圖: