問題描述
樣例輸入
一個滿足題目要求的輸入範例。
3 10
樣例輸出
與上面的樣例輸入對應的輸出。
數據規模和約定
輸入數據中每一個數的範圍。
例:結果在int表示時不會溢出。
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
using namespace std;
int dfs(int n, int k) {
if (k == 0 || k == n) return 1;
return dfs(n - 1, k) + dfs(n - 1, k - 1);
}
int main() {
int k, n;
cin >> k >> n;
cout << dfs(n, k);
return 0;
}