F. Group Projects time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output There are n students in a class working on group projects. The students will divide into groups (some students may be in g…
题目大意: 给定\(n\)个数\(a[1]\sim a[n]\),让你把它分为若干个集合,使每个集合内最大值与最小值的差的总和不超过\(K\).问总方案数. 解题思路: 一道很神的dp题. 首先将数进行排序,然后将这些数扔数轴上,则集合价值相当于在数轴上覆盖这些点所用的最短线段的长度(当然长度可以为0). 考虑dp,设\(f[i][j][k]\)表示考虑了前\(i\)个点,目前还未确定右端点的集合还有\(j\)条,目前的总价值为\(k\),则 不论如何,新加进\(a[i+1]-a[i]\)这条线…
题目链接  8VC Venture Cup 2016 - Elimination Round 题意  把$n$个物品分成若干组,每个组的代价为组内价值的极差,求所有组的代价之和不超过$k$的方案数. 考虑DP,$f[i][j][k]$表示考虑到第$i$个物品的时候,还有$j$组尚未分配完毕,当前状态总代价为$k$的方案数. 先把$a[]$升序排序,那么极差就可以转化为后面的元素减前面的元素不停叠加的效果. 当考虑第$i$个物品的时候有$4$种转移方法: 当前物品新开一组并且继续等待分配: 当前物…
题意:一群匪徒要进入一个酒店.酒店的门有k+1个状态,每个匪徒的参数是:进入时间,符合的状态,携带的钱. 酒店的门刚开始状态0,问最多这个酒店能得到的钱数. 思路: dp数组为DP[T][K]. 转移方程dp[i][j]=max(dp[i-1][j],dp[i-1][j-1],dp[i-1][j+1]) 因为转移i只跟i-1有关,所以可以用滚动数组dp[2][k]. 其实这道题的转移方程很容易想到,只是编程的时候处理边界等细节比较麻烦.还有学习了滚动数组 #include <iostream>…
Description 有n根木棍, 第i根木棍的长度为Li,n根木棍依次连结了一起, 总共有n-1个连接处. 现在允许你最多砍断m个连接处, 砍完后n根木棍被分成了很多段,要求满足总长度最大的一段长度最小, 并且输出有多少种砍的方法使得总长度最大的一段长度最小. 并将结果mod 10007... Input 输入文件第一行有2个数n,m.接下来n行每行一个正整数Li,表示第i根木棍的长度.n<=50000,0<=m<=min(n-1,1000),1<=Li<=1000. O…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3392 Pie Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 793    Accepted Submission(s): 214 Problem Description A lot of boys and girls come to ou…
2101: [Usaco2010 Dec]Treasure Chest 藏宝箱 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 592  Solved: 319[Submit][Status][Discuss] Description Bessie and Bonnie have found a treasure chest full of marvelous gold coins! Being cows, though, they can't ju…
Description A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal number of characters to be inserted into t…
Charm Bracelet Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 47440   Accepted: 20178 Description Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible fro…
题目链接:HDU 5119 Problem Description Matt has N friends. They are playing a game together. Each of Matt's friends has a magic number. In the game, Matt selects some (could be zero) of his friends. If the xor (exclusive-or) sum of the selected friends'ma…