标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 33418 Accepted Submission(s):
22667
import java.util.*;
class Main
{
public static void main(String args[])
{Scanner cin=new Scanner(System.in);
while(cin.hasNext())
{int n=cin.nextInt();
int m=cin.nextInt();
if(n==0&&m==0)
break;
else
{int []a=new int[m+1];
a[2]=n*n;
for(int i=3;i<m+1;i++)
{a[i]=(a[i-1]%1000)*n;}
if(a[m]>999)
{a[m]=a[m]%1000;}
System.out.println(a[m]);
}
}
}
}
这个我们可以知道去后面的三位数只需要取后面的三位数就可以去相乘了;
标签:
原文地址:http://www.cnblogs.com/1314wamm/p/5316350.html