Baekjoon Algorithm | Problem 10951: A+B - 4
Source
https://www.acmicpc.net/problem/10951
Problem
Solve Baekjoon Online Judge problem 10951, A+B - 4.
Input
Follow the input format and constraints given in the original problem statement.
Output
Print the answer required by the problem.
Sample Input 1
1 1 2 3 3 4 9 8 5 2
Sample Output 1
2 5 7 17 7
Algorithm Classification
- Math
- Implementation
- Arithmetic
Solution
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
try (
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
) {
String line;
while ((line = br.readLine()) != null) {
String[] input = line.split(" ");
final int a = Integer.parseInt(input[0]);
final int b = Integer.parseInt(input[1]);
bw.write((a + b) + "\n");
}
bw.flush();
}
}
}