Baekjoon Algorithm | Problem 15596: Sum of N Integers
Source
https://www.acmicpc.net/problem/15596
Problem
Solve Baekjoon Online Judge problem 15596, Sum of N Integers.
Input
Follow the input format and constraints given in the original problem statement.
Output
Print the answer required by the problem.
Algorithm Classification
- Math
- Implementation
- Arithmetic
Solution
import java.util.Arrays;
public class Test {
long sum(int[] a) {
long ans = 0;
ans = Arrays.stream(a).sum();
return ans;
}
}
public class Test {
long sum(int[] a) {
long ans = 0;
for (int i : a) {
ans += i;
}
return ans;
}
}