代码:
#include <iostream> using namespace std; int F(int _n, int _m) { if(_n < _m) return 0; if(_n == _m) return 1; if(_m == 0) return 1; return F(_n - 1, _m - 1) + F(_n - 1, _m); } int main() { int n, m; cin >> n >> m; cout << F(n, m); return 0; }
代码理解参考: