class Solution {public: int maxProfit(vector
&prices) { int len = prices.size(); if (len maxv) { maxv = cur; ...
分类:
其他好文 时间:
2014-05-22 05:09:49
阅读次数:
256
http://acm.hdu.edu.cn/showproblem.php?pid=1811拓扑排序和并差集 1 #include 2 #include 3
#include 4 #include 5 #include 6 #define maxn 10010 7 using...
分类:
其他好文 时间:
2014-05-19 15:49:13
阅读次数:
243
思路:知道要用DP做,但是一开始思路是错的。后来参考了http://blog.csdn.net/pickless/article/details/12034365才意识到可以在整个区间的每一点切开,然后分别计算左子区间和右子区间的最大值,然后再用O(n)时间找到整个区间的最大值。看来以后碰到与2相关...
分类:
其他好文 时间:
2014-05-19 14:13:38
阅读次数:
286
链接:CTU Open 2008【2014/05/15】今晚做了一下CTU
2008的这套题,最后的rank是3道题。基本是水题啊,我们做的是4个小时,如果完整做,我想应该还会出掉D题,主要是D题很繁琐,weikd写起都说烦。A
-Alea iacta estB -On-Line Banking【题...
分类:
其他好文 时间:
2014-05-19 10:23:03
阅读次数:
209
Say you have an array for which theithelement
is the price of a given stock on dayi.If you were only permitted to complete at
most one transaction (ie...
分类:
其他好文 时间:
2014-05-18 20:30:16
阅读次数:
301
int const MAX_N=100000;int par[MAX_N];//父亲int
rank[MAX_N];//树的高度//初始化n个元素void init(int n){ for(int i=0;i#includeint const
MAX_N=100000;int const MA...
分类:
其他好文 时间:
2014-05-18 19:20:37
阅读次数:
278
Problem Description
GG is some what afraid of his MM. Once his MM asks, he will always try his best to rush to their home.
Obvious, he can run home in straight line directly. Alternatively, he ca...
分类:
其他好文 时间:
2014-05-18 07:28:10
阅读次数:
268
http://acm.hdu.edu.cn/showproblem.php?pid=2680这道题是有向图。把全部可以出发的点进队列spfa就可以。 1
#include 2 #include 3 #include 4 #include 5 #include 6 #define maxn ...
分类:
其他好文 时间:
2014-05-18 00:20:31
阅读次数:
248
题目1:Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie,...
分类:
其他好文 时间:
2014-05-16 01:46:15
阅读次数:
460
http://www.csdn.net/article/2014-05-04/2819586-the-best-xcode-plugins5.KSImageNamedKSImageNamed是一款能够帮助开发者在Xcode中自动补全图片文件名称的插件,其开发者Kent
Sutherland来自美国波...
分类:
其他好文 时间:
2014-05-16 00:13:44
阅读次数:
355