Baekjoon Algorithm | Problem 11022: A+B - 8
Source
https://www.acmicpc.net/problem/11022
Problem
Solve Baekjoon Online Judge problem 11022, A+B - 8.
Input
Follow the input format and constraints given in the original problem statement.
Output
Print the answer required by the problem.
Sample Input 1
5 1 1 2 3 3 4 9 8 5 2
Sample Output 1
Case #1: 1 + 1 = 2 Case #2: 2 + 3 = 5 Case #3: 3 + 4 = 7 Case #4: 9 + 8 = 17 Case #5: 5 + 2 = 7
Algorithm Classification
- Math
- Implementation
- Arithmetic
Solution
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
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));
) {
int n = Integer.parseInt(br.readLine());
for (int i = 1; i <= n; i++) {
String[] input = br.readLine().split(" ");
final int a = Integer.parseInt(input[0]);
final int b = Integer.parseInt(input[1]);
bw.write("Case #" + i + ": " + a + " + " + b + " = " + (a + b) + "\n");
}
bw.flush();
}
}
}