코딩로그
[백준/BOJ/C++] 7891번 Can you add this? 본문
[문제]
Given two integers, calculate and output their sum.
[입력]
The input contains several test cases. The first line contains and integer t (t ≤ 100) denoting the number of test cases. Then t tests follow, each of them consisiting of two space separated integers x and y (−10^9 ≤ x, y ≤ 10^9).
[출력]
For each test case output output the sum of the corresponding integers.
[Source Code]
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int test;
cin >> test;
int *arr = new int[test];
for(int i = 0; i < test; i++){
int a, b;
cin >> a >> b;
arr[i] = a + b;
}
for(int i = 0; i < test; i++){
cout << arr[i] << "\n";
}
}
[결과 화면]
'YJ > C++' 카테고리의 다른 글
[백준/BOJ/C++] 8370번 Plane (0) | 2021.10.22 |
---|---|
[백준/BOJ/C++] 10093번 숫자 (0) | 2021.10.22 |
[백준/BOJ/C++] 16170번 오늘의 날짜는? (0) | 2021.10.22 |
[백준/BOJ/C++] 17863번 FYI (0) | 2021.10.22 |
[백준/BOJ/C++] 17094번 Serious Problem (0) | 2021.10.22 |