博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Get Sauce(状压DP)
阅读量:4549 次
发布时间:2019-06-08

本文共 1250 字,大约阅读时间需要 4 分钟。

描述

In order to celebrate the 8th anniversary of ZOJ, LCLL goes to a sauce factory to "Get Sauce". The factory has N kinds of materials. If we combine some of them, we will get a bottle of sauce. LCLL is a sauce genius, he knows about M ways to make the sauce with these materials. Now LCLL wants to get as many bottles of sauce as possible, but he can use each kind of material only once. How many bottles of sauce will LCLL take home at most?

输入

The input file will contain multiple test cases. Each case contains two integers N and M(0 <=N <= 16, 0<= M <=50,000), then there are M lines, each line describe a way to make sauce like this: K a1,a2...aK where K(1<=K<=N) is the number of kinds of materials, ai is a number between[1,N] represents a kind of material this way needs.

Process to the end-of-file.

输出

For each test case print a single line that contains the number of the bottles of sauce LCLL will get at most.

样例输入

5 3

2 1 2
2 2 3
2 3 4

5 2

1 1
4 1 2 3 4

样例输出

2

1

题目大意:

现在有n种材料(每种只有一个),m种方案,每种方案需要若干种材料,求最多能 完成的方案数。

#include 
using namespace std;int dp[1<<16];int main(){ int n,m; while(~scanf("%d%d",&n,&m)) { memset(dp,0,sizeof dp); int S=(1<

 

转载于:https://www.cnblogs.com/zdragon1104/p/9499691.html

你可能感兴趣的文章
A熟知SP.NET---WebForms UnobtrusiveValidationMode 必须“jquery”ScriptResourceMapping。
查看>>
alternatives命令使用方法
查看>>
IDEA Maven配置
查看>>
mapreduce 实现矩阵乘法
查看>>
Jquery EasyUI封装简化操作
查看>>
OO第一单元总结
查看>>
[原创]你所需要了解的软件测试相关标准
查看>>
最近这么火的iOS视频直播
查看>>
程序员陪女朋友自拍杆哪个好?自拍杆品牌推荐
查看>>
output 参数在存储过程中的用法
查看>>
大数加法和乘法(高精度)
查看>>
利用SynchronizationContext.Current在线程间同步上下文
查看>>
单片机reg51.h头文件详解(1)
查看>>
python各种类型转换-int,str,char,float,ord,hex,oct等
查看>>
sublime Text3 快捷键
查看>>
HDU - 3416-Marriage Match IV (最大流 + 最短路)
查看>>
19 年书单
查看>>
力扣——各位相加
查看>>
规范 : Sql statusEnum
查看>>
jQuery的.live()和.die() 使用介绍
查看>>