Updated:

1. 문제 링크

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

2. 사용 알고리즘

구현

3. 풀이

두 개의 정수를 입력받아 덧셈 결과 출력

4. 소스 코드

4-1. C++

https://github.com/dev-aiden/problem-solving/blob/main/boj/11022.cpp

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

using namespace std;

int main(void) {
    ios_base::sync_with_stdio(false);
    int t, tc = 1; for (cin >> t; t--;) {
        int a, b; cin >> a >> b;
        cout << "Case #" << tc++ << ": " << a << " + " << b << " = " << a + b << '\n';
    }
    return 0;
}

4-2. JAVA

https://github.com/dev-aiden/problem-solving/blob/main/boj/11022.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        int t = Integer.parseInt(br.readLine()), tc = 1;
        for(int i = 0; i < t; ++i) {
            String str = br.readLine();
            int a = str.charAt(0) - 48;
            int b = str.charAt(2) - 48;
            sb.append("Case #").append(tc++).append(": ").append(a).append(" + ").append(b).append(" = ").append(a + b).append('\n');
        }
        System.out.println(sb);
        br.close();
    }
}

Updated:

Leave a comment