HDU 6024 Building Shops】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6024 题意:有n个room在一条直线上,需要这这些room里面建造商店,如果第i个room建造,则要总花费加上Ci , 不建造的话, 总花费就要加上去左边的第一间商店的距离.求总的最小花费. 题解:dp1[i] 为第i个建造的最小花费, dp2[i] 为第i个不建造的最小花费. dp1[i] = min(dp1[i-1], dp2[i-1]) + Ci dp2[i] = min(dp2[i], dp…
$dp$. $dp[i]$表示到$i$位置,且$i$位置建立了的最小花费,那么$dp[i] = min(dp[k]+cost[i+1][k-1])$,$k$是上一个建的位置.最后枚举$dp[i]$,加上最后一段的花费,取个最小值即可. #include <bits/stdc++.h> using namespace std; ; const long long inf=1e18; int n; struct X { long long pos; long long cost; }s[]; bo…
Building Shops                                                             Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)                                                                                          …
Building Shops Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 4446    Accepted Submission(s): 1551 Problem Description HDU’s n classrooms are on a line ,which can be considered as a number li…
HDU 5033 Building(单调栈) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5033 Description Once upon a time Matt went to a small town. The town was so small and narrow that he can regard the town as a pivot. There were some skyscrapers in the town, each l…
Problem Description After enjoying the movie,LeLe went home alone. LeLe decided to build blocks. LeLe has already built  piles. He wants to move some blocks to make  consecutive piles with exactly the same height . LeLe already put all of his blocks…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6024 Problem Description HDU’s n classrooms are on a line ,which can be considered as a number line. Each classroom has a coordinate. Now Little Q wants to build several candy shops in these n classrooms…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 379    Accepted Submission(s): 144 Problem Description HDU’s n classrooms are on a line ,which can be considered as a number line. Each classro…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5033 解题报告:在一条x轴上有n个建筑物,每个建筑物有一个高度h,然后现在有q次查询,查询的内容是假设有一个人站在xi这个位置,问他看天空的视角是多大,用角度表示. 数据量都比较大,n和q都是10^5,但因为q次都是查询操作,并没有要求在线更新和查询,所以我们想到用离线算法,先把全部的输入接收,然后离线算出最后打出结果. 这题的思路是把所有的建筑物按照高度从大到小排序,然后所有的查询按照x从小到大排…
Building Block Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3250    Accepted Submission(s): 973 Problem Description John are playing with blocks. There are N blocks (1 <= N <= 30000) numbere…