POJ 1260-Pearls(DP)】的更多相关文章

http://poj.org/problem?id=1260 Pearls Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8474   Accepted: 4236 Description In Pearlania everybody is fond of pearls. One company, called The Royal Pearl, produces a lot of jewelry with pearls…
1.POJ 1260 2.链接:http://poj.org/problem?id=1260 3.总结:不太懂dp,看了题解 http://www.cnblogs.com/lyy289065406/archive/2011/07/31/2122652.html 题意:珍珠,给出需求,单价,要求用最少的钱就可以买到相同数量的,相同(或更高)质量的珍珠. 把握题意,1.输入时,后输入的珍珠价格一定比前面输入的要贵.2.用高质量珍珠替代低质量. #include<iostream> #include…
思路: 直接DP也能做,这里用斜率DP. dp[i] = min{ dp[j] + ( sum[i] - sum[j] + 10 )*pr[i]} ; k<j<i  =>  dp[j] - dp[k] <pr[i]*( sum[j] - sum[k] ) 再套模板 #include<queue> #include<cstring> #include<set> #include<map> #include<stack> #i…
题目链接 题意 : 在一个二维直角坐标系中,有n×n个洞,每个洞的坐标为(x,y), 0 ≤ x, y < n,给你一把锤子可以打到地鼠,最开始的时候,你可以把锤子放在任何地方,如果你上一秒在(x1,y1),那下一秒直线移动到的整数点(x2,y2)与这个点的距离小于等于d,并且当锤子移动(x2,y2)这个点时,所有在两点的直线上的整点数都可以打到.例如(0,0)移动到(0,3).如果(0,1),(0,2)有老鼠出现就会被打到.求能够打的最多老鼠. 思路 : Dp[i][j][k]代表点(i,j)…
Sumsets Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 400000/200000K (Java/Other) Total Submission(s) : 4   Accepted Submission(s) : 3 Problem Description Farmer John commanded his cows to search for different sets of numbers that sum to a g…
http://poj.org/problem?id=2229 题意很简单就是给你一个数n,然后选2的整数幂之和去组成这个数.问你不同方案数之和是多少? n很大,所以输出后9位即可. dp[i] 表示组成i的不同方案数,那么 dp[1]=1;dp[2]=2; if(i%2) dp[i]=dp[i-1] ;  i如果是奇数,那么只能在i-1的每个方案数前面加上1得到i,所以方案数相等. else dp[i]=dp[i-1]+dp[i/2] ;  i如果是偶数,一种可能是i有两个1,在i-1的每个方案…
Pearls Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2018    Accepted Submission(s): 953 Problem Description In Pearlania everybody is fond of pearls. One company, called The Royal Pearl, pro…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1300 题目大意:珠宝店有100种不同质量的珍珠,质量越高价钱越高,为了促进销售,每买一种类型的珍珠,要在原来的基础上必须再买10个.这时一个CFO发现,这种条件下,有时买质量更好的反而更便宜.比如要买10元的珍珠5个,20元的珍珠100个,普通的买法需要(5+10)*10 + (100+10)*20 = 2350,但是如果只买105个价值20元的珍珠,只需要 (5+100+10)*20 = 2300…
Description One traveler travels among cities. He has to pay for this while he can get some incomes. Now there are n cities, and the traveler has m days for traveling. Everyday he may go to another city or stay there and pay some money. When he come…
[POJ 3071] Football(DP) Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4350   Accepted: 2222 Description Consider a single-elimination football tournament involving 2n teams, denoted 1, 2, -, 2n. In each round of the tournament, all tea…