1010 - 다리 놓기

solution

code

#include <iostream>
using namespace std;

int combarr[31][31] {0, };

int combination(int total, int select)
{
    if (select == 0)
    {
        combarr[total][select] = 1;
        return 1;
    }
    else if (select == total)
    {
        combarr[total][select] = 1;
        return 1;
    }
    else
    {
        if(combarr[total][select] == 0)
            combarr[total][select]
							 = combination(total-1, select-1) + combination(total-1, select);
        return combarr[total][select];
    }
}

int main()
{
    int count;
    int N, M;
    cin >> count;
    while(count--)
    {
        cin >> N;
        cin >> M;
        cout << combination(M, N) << endl;
    }

    return 0;
}
# ref [1010번: 다리 놓기](https://www.acmicpc.net/problem/1010)