Baekjoon Algorithm | Problem 11021: A+B - 7

Source

https://www.acmicpc.net/problem/11021

Problem

Solve Baekjoon Online Judge problem 11021, A+B - 7.

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: 2 Case #2: 5 Case #3: 7 Case #4: 17 Case #5: 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) + "\n");
            }

            bw.flush();
        }
    }
}