So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests at last. When two "New Year and Christmas Men" meet, thear assistants cut out of cardboard the letter...
分类:
其他好文 时间:
2014-07-22 23:03:53
阅读次数:
521
从Vista开始,想阻止系统关机就开始变麻烦了,不能只拦截WM_QUERYENDSESSION了,操作系统只给一个应用程序两秒钟的时间去保存自己的东西,两秒钟之后,不管做完了没有,Game Over!可是如果你正在刻录一张光盘呢?两秒钟是都不够的,所以Vista之后也给提供了一种方式阻止系统关机,就是ShutdownBlockReasonCreate函数,只要调用这个函数,第一个参数传递创建主窗口...
[ 问题: ]
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were
inserted in order. You may assume no duplicates in th...
分类:
其他好文 时间:
2014-07-22 23:01:15
阅读次数:
270
题目链接:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5170
Attack on Titans
Time Limit: 2 Seconds Memory Limit: 65536 KB
Over centuries ago, mankind faced a new enemy, th...
分类:
其他好文 时间:
2014-07-22 23:00:16
阅读次数:
536
29:数组中出现次数超过一半的数字 方法a. 排序取中 O(nlogn) 方法b.
partition 函数分割找中位数 >=O(n) 方法 c. 设计数变量,扫描一遍。 O(n)#include int findNumber(int
data[], unsigned length){/* if(c...
分类:
其他好文 时间:
2014-05-02 19:47:41
阅读次数:
535
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-05-01 22:08:19
阅读次数:
366
You are given two linked lists representing two
non-negative numbers. The digits are stored in reverse order and each of their
nodes contain a single ...
分类:
其他好文 时间:
2014-05-01 20:18:54
阅读次数:
425
Icicle
注:我用的是最简化的数据。如果想加text,也很简单,只是在clicked中会重新定义y,所以在更新text时需要x(d.x+d.dx/2);(大概),刚开始定义时也可这样写,因为没有变scale,所以x(d.x)+x(d.dx)/2;也...
分类:
其他好文 时间:
2014-05-01 19:21:33
阅读次数:
298
题目:
Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height.
翻译:
给定一个有序数组(递增),写程序构建一棵具有最小高度的二叉树。
思路:
要使二叉树的高度最小,则要尽量使其左右子树的节点数目相当,自然就考虑到将其构造成为二叉排序树,且将有序数组的中间大的数作为根节点,这样得到的二叉树的高度便是最小的。...
分类:
其他好文 时间:
2014-05-01 17:48:45
阅读次数:
321
又是一个新的算法,原来可以这样查找的。
我的一句话理解的思想:
计算可以抵消的数量,那么如果一个数出现的次数超过半那么最终这个数肯定不会被抵消完。
这个思想叫 Moore’s Voting Algorithm
有了这个思想武器之后,程序就可以写的很简单,可以很清楚看到怎么实现的,
参考资料可以看:...
分类:
其他好文 时间:
2014-04-29 13:22:22
阅读次数:
260