20 lines
452 B
C++
20 lines
452 B
C++
#include<iostream>
|
|
using namespace std;
|
|
int main(){
|
|
long long n,m,f[52][6]={0};
|
|
cin>>n>>m;
|
|
f[0][0]=1;
|
|
f[1][0]=1;
|
|
for(int i=1;i<=n;i++){
|
|
//cout<<f[i][0]<<" ";
|
|
f[i+1][0]=f[i][0];
|
|
for(int j=1;j<=m-1;j++){
|
|
f[i][j]=f[i-1][j-1];
|
|
f[i+1][0]+=f[i][j];
|
|
if(j==i) break;
|
|
//cout<<f[i][j]<<" ";
|
|
}
|
|
//cout<<endl;
|
|
}
|
|
cout<<f[n+1][0];
|
|
} |