首页 > 其他 > 详细

HDU 3006

时间:2015-01-29 19:32:55      阅读:306      评论:0      收藏:0      [点我收藏+]
#include<stdio.h>
#include<string.h>
int mark[1<<16];
int main()
{
	int i,j,n,m,k,t,tot;
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		memset(mark,0,sizeof(mark));
		for(i=1;i<=n;i++)
		{
			scanf("%d",&t);
			tot=0;
			for(j=1;j<=t;j++)
			{
				scanf("%d",&k);
				tot=tot|(1<<(k-1));
			}
			mark[tot]=1;
			for(j=1;j<(1<<m);j++)
			{
				if(mark[j])
				{
					mark[j|tot]=1;
				}
			}
		}
		int ans=0;
		for(j=1;j<(1<<(m));j++)
		{
			if(mark[j]) ans++;
		}
		printf("%d\n",ans);
	}
}

HDU 3006

原文:http://blog.csdn.net/l133236116/article/details/43274661

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!