We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Scanner scan = new Scanner(System.in);
int length = scan.nextInt();
scan.nextLine();
// using BigInteger : Initializing at 0
BigInteger sum = new BigInteger("0");
String temp;
for(int x=0;x<length;x++){
temp = scan.nextLine();
BigInteger tempInt = new BigInteger(temp);
sum = sum.add(tempInt);
}
String testString = sum + "";
System.out.println(testString.substring(0,10));
Project Euler #13: Large sum
You are viewing a single comment's thread. Return to all comments →
My solution in java :
{
}