Last active
January 7, 2019 07:44
-
-
Save ClearNB/f2438b803dbad53ca1634e6055a415d8 to your computer and use it in GitHub Desktop.
Large sum (Java 8 ver) Sample by ClearNB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
import java.util.Scanner; | |
public class Solution { | |
public static void main(String[] args) { | |
BigInteger bi = new BigInteger("0"); | |
try (Scanner sc = new Scanner(System.in)) { | |
int N = sc.nextInt(); | |
for(int i = 0; i < N; i++) { | |
BigInteger nl = sc.nextBigInteger(); | |
bi = bi.add(nl); | |
} | |
System.out.println(bi.toString().substring(0, 10)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment