http://noi.openjudge.cn/ch0206/9267/
设f[i][j]为前i个坑现在已经连续埋了j个核燃料的方案,f[1][0] = 1; f[1][1] = 1;
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ms(i,j) memset(i,j, sizeof i);
using namespace std;
int n,m;
long long f[55][10];
int main()
{
scanf("%d%d", &n, &m);
ms(f,0); f[1][0] = 1; f[1][1] = 1;
for (int i=2;i<=n;i++)
for (int j=0;j<m;j++)
{
if (j==0)
{
for (int k=0;k<m;k++) f[i][j] += f[i-1][k];
} else f[i][j] += f[i-1][j-1];
}
long long ans = 0;
for (int i=0;i<m;i++) ans += f[n][i];
printf("%lld\n", ans);
return 0;
}