一个用来分割字符串的函数:
strtok
char * strtok ( char * str, const char * delimiters );
Split string into tokens
A sequence of calls to this function split str into tokens, which are sequences of co...
分类:
其他好文 时间:
2014-05-07 16:18:12
阅读次数:
273
本文出自:http://blog.csdn.net/svitter
原题:http://poj.org/problem?id=1141
题意:输出添加括号最少,并且使其匹配的串。
题解: dp [ i ] [ j ] 表示添加括号的个数, pos[ i][ j ] 表示i, j中哪个位置分开,使得两部分分别匹配。
初始值置dp [ i ] [ i ] = 1; 如果只有一个括号,...
分类:
其他好文 时间:
2014-05-07 15:17:21
阅读次数:
367
http://www.oschina.net/news/49207/best-php-debugging-tools
调试相关工具https://github.com/barryvdh/laravel-debugbarhttp://identicon-php.org/https://github.c...
分类:
Web程序 时间:
2014-05-07 14:16:02
阅读次数:
364
这道题虽然是上一道题的增强,但是反而简单了。可以交易无数次,但是买卖必须成对的出现。
为了简单起见,我用abc三股股票来说明,且忽略掉相等的情况。三个数一共有六种大小关系。注意他们之间的先后顺序是不能乱的。
1. a
2. b
3. a
4. b
5. c
6. c
好的,你已经看出来了,只要当相邻的两个数是后面一个较大时,就之间累计上他们的差,否则,pass。直观一点的表述,只要...
分类:
其他好文 时间:
2014-05-07 12:33:11
阅读次数:
512
这道题还是挺难的,属于我前面提到的,给个数组,线性时间找出个什么东西,虽然上面的两个买卖股票也是这类,不过相比之下稚嫩多了。有关至少至多的问题比较烦人,不好想,等再做一些题,可能会发现什么规律。这道题的情况还是比较少的,要么买卖了两次,要么一次。
买卖一次的情况,已经解决过了,现在分析买卖两次的情况。两次买卖之间是没有交叉的,即下一次买之前一定已经卖掉了。最容易想到,穷去分点,每个部分都按照买卖...
分类:
其他好文 时间:
2014-05-07 11:27:50
阅读次数:
331
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gr...
分类:
其他好文 时间:
2014-05-07 06:10:17
阅读次数:
370
请不要随便指点别人该怎么做、每个人的人生都应该自己掌握、你给不了别人一切、你也不懂别人的忧伤、
微笑不代表快乐、哭泣不一定悲伤
不努力怎么让那些关心你的人幸福、不努...
分类:
其他好文 时间:
2014-05-07 05:02:04
阅读次数:
263
Subtraction Game 1
Chef is playing a game on a sequence of N positive integers, say A1, A2, ... AN. The game is played as follows.
If all the numbers are equal, the game ends.Otherwise
Sele...
分类:
其他好文 时间:
2014-05-07 03:14:01
阅读次数:
280
How do you know what machine learning algorithm to
choose for your classification problem? Of course, if you really care about
accuracy, your best bet...
分类:
其他好文 时间:
2014-05-07 00:50:14
阅读次数:
438
Problem:The sequence of triangle numbers is
generated by adding the natural numbers. So the 7thtriangle number would be 1 +
2 + 3 + 4 + 5 + 6 + 7 = 28...
分类:
其他好文 时间:
2014-05-07 00:28:01
阅读次数:
365