백준
[2775] 부녀회장이 될테야
by Jcoder
2018. 7. 14.
#include <iostream>
using namespace std;
int sol(int f, int h);
int person[15][15] = { 0, };
int main(){
int testcase, k, n;
cin >> testcase;
for (int i = 0; i < 15; i++)
{
person[0][i] = i + 1;
person[i][0] = 1;
}
for (int i = 0; i < testcase; i++)
{
cin >> k;
cin >> n;
cout << sol(k, n-1) << endl;
}
return 0;
}
int sol(int f, int h)
{
int i, j;
for (i = 1; i <= f; i++)
{
for (j = 1; j <= h; j++)
{
person[i][j] = person[i][j-1] + person[i-1][j];
}
}
return person[f][h];
}