作者在 2008-04-26 18:29:30 发布以下内容
http://acm.hdu.edu.cn/showproblem.php?pid=1723
#include<stdio.h>
#include<string.h>
int main()
{
int n,m,a[31],i,j,b;
while(scanf("%d%d",&n,&m)!=EOF)
{
if(n==0&&m==0)break;
for(i=0;i<31;i++)
a[i]=1;
for(i=n-1;i>0;i--)
{
b=0;
for(j=i+1;j<=n&&j-i<=m;j++)
b=b+a[j]*a[i];
a[i]=b;
}
printf("%d\n",a[1]);
}
return 0;
}