题目
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring...
分类:
其他好文 时间:
2014-06-16 22:41:41
阅读次数:
267
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1518
题目为:
Square
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7839 Accepted Submi...
分类:
其他好文 时间:
2014-06-16 22:34:36
阅读次数:
279
1、vector
变长一维数组,连续存放的内存块,有保留内存,堆中分配内存;
支持[]操作,高效率的随机访问;
在最后增加元素时,一般不需要分配内存空间,速度快;在中间或开始操作元素时要进行内存拷贝效率低;
vector高效的原因在于配置了比其所容纳的元素更多的内存,内存重新配置会花很多时间;
注:需要高效的随即存取,而不在乎插入和删除使用vector。
...
分类:
其他好文 时间:
2014-06-16 22:11:01
阅读次数:
239
一、基本类型
1.string类型是值引用的,简单地说就是把String A作为参数传出去到String B,不管B的值如何改变,A是不会改变的,除非手动改变A的值。
2.在看翻译过来的中文版本时,发现一个问题,说数组是存放相同类型的的数据的一个集合,其数据类型也可通过自动推断方式获取,可不必声明,但在实际code过程中,发现一个问题如下:
//不加类型声明,可以在初始化时在数组中添加Str...
分类:
其他好文 时间:
2014-06-16 21:48:20
阅读次数:
233
数组构造二叉树并打印本文地址: http://blog.csdn.net/caroline_wendy数组:构造二叉树, 需要使用两个队列(queue), 保存子节点和父节点, 并进行交换;打印二叉树, 需要使用两个队列(queue), 依次打印父节点和子节点, 并进行交换;二叉树的数据结构:struct BinaryTreeNode {
int m_nValue;
BinaryTreeNod...
分类:
其他好文 时间:
2014-06-16 19:45:17
阅读次数:
373
题目链接:Codeforces 439D Devu and his Brother
题目大意:Devu和他的哥哥互相深爱着对方,我确信他们是搞基的,为此我还去查了一下Devu是男人名还是女人名,但是后来发现His Brother,所以可以证明,他们就是搞基的。题目很简单,父亲给了他们两个人分别一个数组。但是Devu希望自己最小的数都可以不必哥哥最大的数小,现在对数组中的数有两种操作,一...
分类:
其他好文 时间:
2014-06-16 19:22:38
阅读次数:
186
题目
Divide two integers without using multiplication, division and mod operator.
方法
将除数倍加,直到大于被除数。
public int divide(int dividend, int divisor) {
int flag = 0;
if...
分类:
其他好文 时间:
2014-06-16 19:08:08
阅读次数:
200
Perl数组的声明方式
Perl使用"@"符号声明一个数组:@array;
使用"()"或"qw()"声明数组中元素;
一个完整的声明方式为:
@array = (12,"123","abc",$var);......方法一
或者
@array = qw(12 123 abc); ............方法二
或者
@array = (1..10).................
分类:
其他好文 时间:
2014-06-16 18:50:39
阅读次数:
182
题目
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the low...
分类:
其他好文 时间:
2014-06-16 18:48:33
阅读次数:
170
题目链接:Codeforces 439C Devu and Partitioning of the Array
题目大意:给出n个数,要分成k份,每份有若干个数,但是只需要关注该份的和为奇数还是偶数,要求偶数堆的个数为p。输出方案。
解题思路:首先先将数组按照奇偶排序,也可以分开储存。然后先单独分k-p个奇数,然后后面的就将两个奇数当一个偶数分配,分配过程中计算是否满足,比如...
分类:
其他好文 时间:
2014-06-16 14:51:17
阅读次数:
216