A Famous Stone Collector Problem Description Mr. B loves to play with colorful stones. There are n colors of stones in his collection. Two stones with the same color are indistinguishable. Mr. B would like to  select some stones and arrange them in l…
A Famous Stone Collector Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 793    Accepted Submission(s): 292 Problem Description Mr. B loves to play with colorful stones. There are n colors of…
DP: dp[i][j]前i堆放j序列长度有多少行法, dp[i][j]=dp[i-1][j] (不用第i堆), dp[i][j]+=dp[i-1][j-k]*C[j][k] (用第i堆的k个石头) A Famous Stone Collector Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 845    Accepted Su…
首先发现一个很头痛的问题,下面是2个求排列组合的代码 memset(C,,sizeof(C)); ;i<;i++) { C[i][]=; ;j<=;j++) C[i][j]=(C[i-][j]+C[i-][j-])%MOD; } C[][]=; ;i<;i++) ;j<=;j++) ) C[i][j]=C[i-][j]; ][j]+C[i-][j-])%MOD; 其中第一个是刘汝佳上面的代码,不知为什么在杭电OJ上就是WA,第二个就能AC,就路过的大神指点 题目大意 给你一些不同颜…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4249 题目大意:给一个a+b=c的表达式,但是a.b.c中部分位的数字丢失,并用?代替,问有多少种方案使得这个表达式成立. Sample Input 7+1?=1? ?1+?1=22   Sample Output Case 1: 3 Case 2: 1   Hint There are three solutions for the first case: 7+10=17, 7+11=18, 7+…
Working out time limit per test  2 seconds memory limit per test  256 megabytes input  standard input output  standard output Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where th…
Fast Food Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2173    Accepted Submission(s): 930 Problem Description The fastfood chain McBurger owns several restaurants along a highway. Recently,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 这是做的第一道01背包的题目.题目的大意是有n个物品,体积为v的背包.不断的放入物品,当然物品有各自的体积和价值.在不超过总体积v的情况下,问能够达到的最大价值.并且物品是一个一个放入的.最后若有剩余的体积也不会填满. 刚开始是用贪心做的.将价值与体积的比值设定为一个值,即单位价值.然后按照单位价值排序,挨个取物品,考虑到了体积为0的情况,就将单位价值设定为无穷大.但是这样做并不能保证最优解.…
HDOJ(HDU).2602 Bone Collector (DP 01背包) 题意分析 01背包的裸题 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nmax 1005 using namespace std; int v[nmax],w[nmax],dp[nmax]; int main() { //freopen("in…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2227 Find the nondecreasing subsequences                                  Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)                                             …