나의 브을로오그으

[c++] 2775번 : 부녀 회장이 될테야 본문

알고리즘/BaekJoon

[c++] 2775번 : 부녀 회장이 될테야

__jhp_+ 2022. 4. 28. 13:49

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

 

2775번: 부녀회장이 될테야

첫 번째 줄에 Test case의 수 T가 주어진다. 그리고 각각의 케이스마다 입력으로 첫 번째 줄에 정수 k, 두 번째 줄에 정수 n이 주어진다

www.acmicpc.net

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int k = 0;
	int n = 0;
	int testCase = 0;
	cin >> testCase;

	int arr[15][15] = { 0, };
	for (int i = 1; i < 15; ++i)
	{
		arr[0][i] = i;
	}
	for (int floor = 1; floor < 15; ++floor)
	{
		for (int no = 1; no < 15; ++no)
		{
			arr[floor][no] = arr[floor - 1][no] + arr[floor][no - 1];
		}
	}
	for (int i = 0; i < testCase; ++i)
	{
		cin >> k >> n;
		cout << arr[k][n] << '\n';
	}

	return 0;
}

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

[c++] 2805번 : 나무 자르기  (0) 2022.04.29
[c++] 2798번 : 블랙잭  (0) 2022.04.28
[c++] 2751번 : 수 정렬하기 2  (0) 2022.04.27
[c++] 2609번 : 최대공약수, 최소공배수  (0) 2022.04.27
[c++] 2292번 : 벌집  (0) 2022.04.15