leetcode - Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given ...
分类:
其他好文 时间:
2015-08-20 12:17:24
阅读次数:
130
题目链接:uva 1463 - Largest Empty Circle on a Segment
二分半径,对于每个半径,用三分求出线段到线段的最短距离,根据最短距离可以确定当前R下每条线段在[0,L]上的可行区间,存在一个点被可行区间覆盖n次。
#include
#include
#include
#include
#include
using namespac...
分类:
其他好文 时间:
2015-08-20 01:32:47
阅读次数:
143
DescriptionProbabilityTime Limit: 1 sec Memory Limit: 16MBConsider rectangular coordinate system and point L(X,Y) which is randomly chosen among all p...
分类:
其他好文 时间:
2015-08-19 10:44:18
阅读次数:
98
Problem Description:You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its i...
分类:
其他好文 时间:
2015-08-18 09:04:26
阅读次数:
100
再次熟悉java当中的comparator的写法Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9]...
分类:
其他好文 时间:
2015-08-17 11:39:49
阅读次数:
85
Memory Limit: 32 MB
In the following figure you can see a rectangular card. Thewidth of the card is
W and length of the card is L and thicknessis zero. Four
(x*x) squares are cut from the...
分类:
其他好文 时间:
2015-08-16 16:46:15
阅读次数:
121
[LeetCode 179] Largest Number|COMMENTSQuestionlinkGiven a list of non negative integers, arrange them such that they form the largest number.For examp...
分类:
其他好文 时间:
2015-08-16 13:43:54
阅读次数:
144
1.题目描述:点击打开链接
2.解题思路:本题利用单调栈解决。单调栈是满足从栈顶到栈底,元素大小严格递增或者严格递减的栈。对于本题,如果我们可以知道以i为端点,向左可以最远延伸的距离和向右最远延伸的距离,那么最大面积res=max{hi*(R[i]-L[i])|0
那么如何高效地计算L[i]和R[i]呢?通过观察我们发现如果在某一处p有h[p]
3.代码:
//#pragma commen...
分类:
其他好文 时间:
2015-08-16 12:22:13
阅读次数:
95
Description
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent til...
分类:
其他好文 时间:
2015-08-15 20:07:33
阅读次数:
111
题意:http://acm.hdu.edu.cn/showproblem.php?pid=1506 如图,求最大的矩形面积思路:笛卡尔树:笛卡尔树是一棵二叉树,树的每个节点有两个值,一个为key,一个为value。光看key的话,笛卡尔树是一棵二叉搜索树,每个节点的左子树的key都比它小,右子树都比...
分类:
其他好文 时间:
2015-08-15 18:17:31
阅读次数:
119