728x90
https://www.acmicpc.net/problem/11050
11050번: 이항 계수 1
첫째 줄에 \(N\)과 \(K\)가 주어진다. (1 ≤ \(N\) ≤ 10, 0 ≤ \(K\) ≤ \(N\))
www.acmicpc.net
최초풀이
#include <iostream>
using namespace std;
int main() {
int N, K, ans = 1;
cin >> N >> K;
for (int i = N; i > N - K; i--) ans *= i;
for (int i = 1; i <= K; i++) ans /= i;
cout << ans;
return 0;
}
728x90
'🥇Baekjoon Solutions > 조합론' 카테고리의 다른 글
[C++] 백준 15663번: N과 M (9) (0) | 2021.07.29 |
---|---|
[C++] 백준 15664번: N과 M (10) (0) | 2021.07.29 |
댓글