Subsequence
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 8128
Accepted: 3141
Description
A sequence of N positive integers (10 < N < 100 000), each of t...
分类:
其他好文 时间:
2014-05-18 15:26:37
阅读次数:
284
4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target....
分类:
其他好文 时间:
2014-05-18 13:49:09
阅读次数:
306
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4662
MU Puzzle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1296 Accepted Submissio...
分类:
其他好文 时间:
2014-05-18 04:16:16
阅读次数:
407
//普通方法
void strcpy1(char str1[], char str2[]){
int i = 0;
for (; str2[i] != '\0'; i++){
str1[i] = str2[i];
}
str1[i] = '\0';
}
//简练方法
void strcpy2(char str1[], char str2[]){
int i = 0;
whil...
分类:
其他好文 时间:
2014-05-18 09:47:40
阅读次数:
273
数字三角形
描述:
有一个由非负整数组成的三角形,第一行只有一个数,除了最下行之外没个数的左下方
和右下方各有一个数。
问题:
从第一行的数开始,每次可以往左下或右下走一格,直到走到最下行,把沿途经过的数
全部加起来。如何走才能使得这个和尽量大?
分析:
不难看出此...
分类:
其他好文 时间:
2014-05-18 18:26:02
阅读次数:
299
本文实现了较为精确的socket数据源...
分类:
其他好文 时间:
2014-05-18 04:29:39
阅读次数:
640
Wrote by mutouyun. (http://darkc.at/a-tricky-code/)
刚刚在网上闲逛,看到reddit上关于最受欢迎的代码的讨论贴,上面有一小段非常有意思的代码:
unsigned int v; // to count the number of bits set in v
unsigned int c; // c accumulates the ...
分类:
其他好文 时间:
2014-05-18 07:44:31
阅读次数:
284
初学设计模式给我最大的感受是:人类真是伟大啊!单单是设计模式的基础课程就让我感受到了强烈的生活气息。个人感觉《大话设计模式》这本书写的真好,让貌似很晦涩难懂的设计模式变的生活化,趣味化。
下面浅谈一下对设计模式基础的理解,如果理解的不好,还请大家指正!
首先设计模式是对面向对象的更专业的诠释,面向对象的三大基本特征是继承、封装、多态。
继承:1.子类继承父类非privat...
分类:
其他好文 时间:
2014-05-18 03:08:45
阅读次数:
326
一直想学学LISP,今天总算开了个头。现在我学习LISP不是为了马上能够用于实际项目的应用,而是为了学习一下函数式的思维方式,能够更加深入的了解计算的本质,能够更好的用C++, Java, Python等编写程序。更何况,这些主流语言都逐渐增加了函数式编程的特征,C++,Java现在都引入了 Lambda 表达式。如果能够系统学习一下LISP,相信对自己以后掌握这些语言的新特新特征,对自己写JavaScript、Python,对自己了解闭包、高阶函数、Lambda表达式都会有很大帮助。言归正传,首先推荐三个...
分类:
其他好文 时间:
2014-05-18 16:01:45
阅读次数:
530
求树的最大路径和(Binary Tree Maximum Path Sum)...
分类:
其他好文 时间:
2014-05-18 18:25:41
阅读次数:
235
【题目】
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
You may not alter the values in the nodes, only n...
分类:
其他好文 时间:
2014-05-18 10:22:34
阅读次数:
367
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4648
Magic Pen 6
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 1857 Accepted Submiss...
分类:
其他好文 时间:
2014-05-18 04:56:14
阅读次数:
317
题目链接:11375 - Matches
题目大意:给出n根火柴,问说能组成多少种数字,要求说0不能打头。
解题思路:d[i]表示i根火柴能够组成的数量,d[i+c[j]] = d[i+c[j]] + d[i];
最后dp[i]表示小于等于i根火柴能组成的数量,dp[i]=∑jidp[j].
高精度。
#include
#include
#include
using na...
分类:
其他好文 时间:
2014-05-18 10:21:35
阅读次数:
286
【题目】
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
For example,
Given input array A ...
分类:
其他好文 时间:
2014-05-18 18:25:19
阅读次数:
272
【调试渲染】
将TestCpp里Box2DTestBed的GLES-Render.h/cpp添加到项目中,声明绘制变量:GLESDebugDraw
mDebugDraw。
【创建世界】
// 根据重力创建世界
b2Vec2 gravity;
gravity.Set(0.0f, -10.0f);
mWorld = new b2World(gravity);
// 设置调试...
分类:
其他好文 时间:
2014-05-18 14:58:02
阅读次数:
316
有限状态自动机是表示有限个状态以及在这些状态之间的转移和动作等行为的数学模型。
使用有限状态自动机可以将复杂的问题简化,比如TCP状态转换。...
分类:
其他好文 时间:
2014-05-18 10:47:09
阅读次数:
278
迷宫规模较大,DFS必然超时。注意到行走方向只有上、下、右三个,意味着已走过的路不能再走,更意味着不用回溯。且问题问的是最大值。一切都清晰地指向了DP!...
分类:
其他好文 时间:
2014-05-18 15:16:29
阅读次数:
328