miércoles, 11 de abril de 2012

Project Euler 48

import java.math.BigInteger;
public class Main {
 public static void main(String[] args) {
  BigInteger res = BigInteger.ONE;
  BigInteger modu = new BigInteger("10000000000");
  for (int i = 2; i <= 1000; i++) 
   res = res.add(new BigInteger(i+"").modPow(new BigInteger(i+""), modu));
  System.out.println(res.mod(modu));
 }
}

No hay comentarios:

Publicar un comentario