본문 바로가기

Dev/BAEKJOON 백준

[백준/BOJ] 백준 코딩 알고리즘 11022번/C++

728x90
반응형

백준 코딩 알고리즘 문제 11022

 

백준 코딩 알고리즘 문제 11022번 풀이 - 사용 언어: C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
 
using namespace std;
 
int main() {
 
    int testCase = 0;
    int a = 0, b = 0;
    int j = 0;
 
    cin >> testCase;
 
    int* inputArray = new int[testCase * 2]();
    int* resultArray = new int[testCase]();
 
    for (int i = 0; i < testCase; i++) {
        cin >> a >> b;
        inputArray[i * 2= a;
        inputArray[i * 2 + 1= b;
        resultArray[i] = a + b;
    }
 
    for (int i = 0; i < testCase; i++) {
        cout << "Case #" << i + 1 << ": " << inputArray[i*2<< " + " << inputArray[i * 2 + 1<< " = " << resultArray[i] << endl;
    }
 
    return 0;
}
cs
728x90
반응형