Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple ...
分类:
其他好文 时间:
2018-03-09 10:37:18
阅读次数:
193
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple ...
分类:
其他好文 时间:
2018-03-09 10:37:05
阅读次数:
141
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1260 解题思路:这是一道简单的DP问题,题目的意思就是有两种购票方式,要么采用单独购票,要么采用双人购票。 即得到状态转移方程:dp[i] = min(dp[i - 1] + tim[i], dp[i ...
分类:
其他好文 时间:
2018-03-07 15:07:18
阅读次数:
128
Ekka and his friend Dokka decided to buy a cake. They both love cakes and that's why they want to share the cake after buying it. As the name suggeste ...
分类:
其他好文 时间:
2018-03-06 17:08:07
阅读次数:
161
http://codeforces.com/problemset/problem/938/D 题意:n个城市,每个城市都要举办场演唱会,票价是a[i],此外还有m条双向有权边连接各个城市,求从每个城市出发,看一场演唱会再返回的最小花费。 样例:in: 4 2 out: 6 14 1 25 1 2 4 ...
分类:
其他好文 时间:
2018-03-04 18:05:30
阅读次数:
186
A friend of yours has taken the job of security officer at the Star-Buy Company, a famous depart- ment store. One of his tasks is to install a video s ...
分类:
其他好文 时间:
2018-03-04 14:42:45
阅读次数:
162
题目名称 buy slide divide 输入 buy.in slide.in divide.in 输出 buy.out slide.out divide.out 每个测试点时限 1秒 1秒 1秒 内存限制 256MB 256MB 256MB 测试点数目 10 10 10 每个测试点分值 10 1 ...
分类:
其他好文 时间:
2018-03-03 19:33:08
阅读次数:
183
倒序 处理,线段树保存有多少空位 cpp include include using namespace std; int n, ans[200005], uu[200005], vv[200005]; struct SGT{ int sum[800005]; void build(int o, i ...
分类:
其他好文 时间:
2018-03-03 18:10:38
阅读次数:
112
传送门:CodeForces - 938D 题意:n个城市,m条路,每条路都有自己的花费,每个城市看演唱会也有自己的花费,问从每一个城市到另一个城市(或就在自己城市)看演唱会的最小花费 题解:迪杰特斯拉,跑多源(每个源有权值)最短路。和一般的跑法不一样,要先给每个dis[]赋值成源的权值然后扔进di ...
分类:
其他好文 时间:
2018-03-03 15:29:51
阅读次数:
168
题目链接:Buy a Ticket 题意: 给出n个点m条边,每个点每条边都有各自的权值,对于每个点i,求一个任意j,使得2×d[i][j] + a[j]最小。 题解: 这题其实就是要我们求任意两点的最短路,但是从点的个数上就知道这题不可以用floyd算法,其实多元最短路可以用dijkstra算。@ ...
分类:
其他好文 时间:
2018-03-03 12:26:30
阅读次数:
120