본문 바로가기
코딩캠프/BOJ

[11051] 이항계수2

by 코곰_ 2024. 2. 22.
// 11051 이항계수2  
// 조합론, 파스칼의 삼각형  
#include<iostream>
#include<cstdio>
#define MAX 1001
using namespace std;

long long dp[MAX][MAX];
int N, K;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
    scanf("%d %d", &N, &K);
    
    dp[0][0] = 1;
    for(int i=1; i<=N; i++){
		dp[i][0] = 1;
		for(int j=1; j<=i; j++){
			dp[i][j] = (dp[i-1][j-1] + dp[i-1][j]) % 10007;
		}
	}
	
	printf("%d", dp[N][K]);
	
	return 0;
}

'코딩캠프 > BOJ' 카테고리의 다른 글

[1932] 정수 삼각형  (1) 2024.02.22
[11659] 구간합 구하기4  (0) 2024.02.22
[11266] 단절점  (1) 2024.02.21
[11050] 이항계수 1  (1) 2024.02.21
[1010] 다리놓기  (0) 2024.02.21