Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
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 29 30
31
Archives
Today
Total
관리 메뉴

코딩로그

[백준/BOJ/C++] 7891번 Can you add this? 본문

YJ/C++

[백준/BOJ/C++] 7891번 Can you add this?

Team DAON 2021. 10. 22. 14:40

[문제]

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