您的位置:首页 > 其它

找单词

2013-11-25 17:03 148 查看
http://acm.hdu.edu.cn/showproblem.php?pid=2082

#include<stdio.h>
#include<string.h>
int main()
{
//freopen("in.txt","r",stdin);
int t;
scanf("%d",&t);
while(t--)
{
int num;
int a[60],b[60];
int i,j,k;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
a[0]=1;
for( i=1;i<=26;i++)
{
scanf("%d",&num);
if(num==0) continue;
for(j=0;j<=50;j++)
{
for(k=0;k<=num&&k*i+j<=50;k++)
b[k*i+j]+=a[j];
}
for(j=0;j<=50;j++)
{
a[j]=b[j];
b[j]=0;
}
}
int tot=0;
for(i=1;i<=50;i++)
tot+=a[i];
printf("%d\n",tot);
}
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: