这道题在前两个的基础上做稍微改进就可以。下面是AC代码: 1 /** 2 * Design an
algorithm to find the maximum profit. You may complete at most two transactions.
3 * @pa...
分类:
其他好文 时间:
2014-07-22 23:01:13
阅读次数:
251
如果要编写定制的Apache模块,最总需要编译成Apache包。
命令如下:
% ./buildconf
% ./configure --prefix=/usr/local/apache
> --with-layout=Apache --enable-modules=most --enable-mods-shared=all > --with-mpm=prefork
% make
#mak...
分类:
其他好文 时间:
2014-07-22 22:59:34
阅读次数:
243
Space AntTime Limit:1000MSMemory Limit:10000KTotal
Submissions:2934Accepted:1874DescriptionThe most exciting space discovery
occurred at the end of th...
分类:
其他好文 时间:
2014-07-22 22:59:15
阅读次数:
365
You should initialize most fields normally, not
lazily. If you must initialize a field lazily in order to achieve your
performance goals, or to break ...
分类:
编程语言 时间:
2014-05-09 18:32:56
阅读次数:
497
DescriptionIn the game of DotA, Pudge’s meat
hook is actually the most horrible thing for most of the heroes. The hook is
made up of several consecuti...
分类:
其他好文 时间:
2014-05-05 11:32:29
阅读次数:
288
http://acm.hdu.edu.cn/showproblem.php?pid=1598
1 #include 2 #include 3 #include 4 #define maxn 2000 5 using namespace std; 6
const int inf=1<<30; 7...
分类:
其他好文 时间:
2014-05-05 10:53:38
阅读次数:
344
Given a non-negative number represented as an array
of digits, plus one to the number.The digits are stored such that the most
significant digit is at...
分类:
其他好文 时间:
2014-05-04 19:46:18
阅读次数:
372
时间复杂度 O(d*n),d 为不同数字数目,n 为待排元素个数。分为: MSD(most
significant digit) 和 LSD(least significant digit)两种方法。MSD:从最高级别的 key
开始排序,每趟排序将所有元素分成 d 堆。LSD: 从最低级别的 k...
分类:
其他好文 时间:
2014-05-03 22:41:16
阅读次数:
418
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-02 00:37:20
阅读次数:
349
Given n non-negative integers a1, a2,
..., an, where each represents a point at coordinate (i, ai). n vertical
lines are drawn such that the two endpoints of line i is at (i, ai) and (i,
0). Fin...
分类:
其他好文 时间:
2014-04-29 13:15:21
阅读次数:
415