uva 10910(子集和问题)】的更多相关文章

Marks Distribution Time limit: 3.000 seconds In an examination one student appeared in N subjects and has got total T marks. He has passed in all the Nsubjects where minimum mark for passing in each subject is P. You have to calculate the number of w…
简单dp /************************************************************************* > Author: xlc2845 > Mail: xlc2845@gmail.com > Created Time: 2013年11月05日 星期二 20时05分30秒 ************************************************************************/ #inclu…
题意 把数字T分成N个数的和,保证这N个数中最小的数大于P.求方案数目 另f[i][j]表示把i分成j个数的和的方案数 f[i][j]=f[i][j-1]+f[i-1][j-1]+f[i-2][j-1]+...f[0][j-1]; f[i-1][j]=f[i-1][j-1]+f[i-2][j-1]+...f[0][j-1]; 两式做差 推出f[i][j]=f[i-1][j]+f[i][j-1]; 那么ans=f[T-NP][N]; #include <map> #include <set…
题目链接:uva 11825 题意: 你是一个黑客,侵入了n台计算机(每台计算机有同样的n种服务),对每台计算机,你能够选择终止一项服务,则他与其相邻的这项服务都终止.你的目标是让很多其它的服务瘫痪(没有计算机有该项服务). 思路:(见大白70页,我的方程与大白不同) 把n个集合P1.P2.Pn分成尽量多的组,使得每组中全部集合的并集等于全集,这里的集合Pi是计算机i及其相邻计算机的集合,用cover[i]表示若干Pi的集合S中全部集合的并集,dp[s]表示子集s最多能够分成多少组,则 假设co…
题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2925 题意 n个节点,每个节点都有完全相同的n项服务. 每次可以选择一个节点,破坏该节点和相邻节点的某项服务. 问最多能完全破坏多少服务? 思路 如刘书, 直接枚举状态的子集 注意元素个数为k的集合有C^k_n个子集,那么枚举的时间复杂度为sum{c^k_n * 2^k} = 3^n…
UVA 1508 - Equipment 状态压缩 枚举子集 dfs ACM 题目地址:option=com_onlinejudge&Itemid=8&category=457&page=show_problem&problem=4254" target="_blank" style="color:rgb(0,136,204); text-decoration:none">UVA 1508 - Equipment--P…
UVA 11825 - Hackers' Crackdown 状态压缩 dp 枚举子集 ACM 题目地址:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2925" style="color:rgb(0,136,204); text-decoration:none">11825 - Hackers' Crackdown 题意:  有一个由编号0~n-1的n台计算机组成的网络,一共…
Hackers’ Crackdown Miracle Corporations has a number of system services running in a distributed computer system which is a prime target for hackers. The system is basically a set of N computer nodes with each of them running a set of Nservices. Note…
The Korea Defense and Science Institute, shortly KDSI, has been putting constant effort into newequipment for individual soldiers for recent years, and at last released N new types of equipment.KDSI has already done evaluation of each of the N types…
https://vjudge.net/problem/UVA-11825 题目大意,有n台服务器,有n种服务,每台服务器都运行着所有的服务,一台服务器可以被攻击一次其中的一种服务,当你选择攻击某台服务器的某个服务时,与他相邻的服务器上的同种的服务也会被攻击,当某种服务在所有的服务器上都不再运行时,我们称消灭了一种服务,求黑客最多消灭几种服务. n最大16,我们容易想到利用二进制表示已经攻击过的电脑,f(S)=MAX{f(S),f(S0^S)+1 | if(S0是S的子集&&S0攻击后可以覆…