끄적끄적 코딩
article thumbnail
Published 2019. 9. 8. 23:13
[C++] 백준 10953번 A+B - 6 알고리즘

덧셈 문제입니다.

입력받는 A,B를 string으로 받아서
다시 A, B에 넣어주어서 더해주었습니다.

 

#include <iostream>
#include <string>
using namespace std;

int main(int argc, char *argv[]) 
{
	int n;
	int a, b;
	string s;

	cin >> n;

	for (int i = 0; i < n; ++i) {
		cin >> s;

		a = s[0] - '0';
		b = s[2] - '0';

		cout << a + b << endl;
	}

	return 0;
}

'알고리즘' 카테고리의 다른 글

[C++] 백준 11365번 !밀비 급일  (0) 2019.09.09
[C++] 백준 1476번 날짜 계산  (0) 2019.09.09
[C++] 백준 1629번 곱셈  (0) 2019.09.08
[C++] 백준 1780번 종이의 개수  (0) 2019.09.08
[C++] 백준 1992번 쿼드트리  (0) 2019.09.08

검색 태그