2 3 12 6 6789 10000 0 0
8 984 1
代码:
import java.math.BigInteger; import java.util.*; public 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{ BigInteger s; BigInteger k= BigInteger.valueOf(n); s= k.pow(m); BigInteger l=new BigInteger("1000"); System.out.println(s.mod(l)); } } } }
原文地址:http://blog.csdn.net/amx50b/article/details/46120059