src2020/1805_kclimb/kclimb.cpp

13 lines
273 B
C++

#include<iostream>
using namespace std;
int main(){
int n,k,f[21][21]={1};
cin>>n>>k;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
f[i][j]=f[i-1][j]+f[i-1][j-1]*j;
if(j==k) break;
}
}
cout<<f[n][k];
}