본문 바로가기
문제 해결/BaekJoon

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

by WSLim_97 2022. 11. 14.
반응형

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

 

7891번: Can you add this?

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 (−109 ≤ x, y ≤ 109).

www.acmicpc.net


코드

#include <iostream>
using namespace std;

int main() {
	int n, a, b;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		cout << a + b << "\n";
	}

	return 0;
}

풀이

반복 횟수를 결정하는 n과 두 수 a, b를 입력받아 a, b의 합을 출력하는 문제이다.

반응형

'문제 해결 > BaekJoon' 카테고리의 다른 글

[백준] [C++] 8393번 합  (0) 2022.11.14
[백준] [C++] 8370번 Plane  (0) 2022.11.14
[백준] [C++] 6810번 ISBN  (0) 2022.11.14
[백준] [C++] 6778번 Which Alien?  (0) 2022.11.13
[백준] [C++] 6749번 Next in line  (0) 2022.11.13