以下转换代码摘自维基百科 Wikipedia:/* The purpose of this function is to convert an unsigned binary number to reflected binary Gray code. Th...
分类:
其他好文 时间:
2015-03-05 14:38:54
阅读次数:
171
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 2469135...
分类:
其他好文 时间:
2015-03-05 14:38:01
阅读次数:
206
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.思路:自己脑子当机了,总是想着斜率和截距都要相同。但实际上三个点是一条直线的话只要它们的斜率相同就可以了,...
分类:
其他好文 时间:
2015-03-05 14:27:52
阅读次数:
132
查询辅助函数$this->db->insert_id()这个ID号是执行数据插入时的ID。$this->db->affected_rows()Displays the number of affected rows, when doing "write\" type queries (insert,...
分类:
其他好文 时间:
2015-03-05 14:16:49
阅读次数:
242
Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets on ...
分类:
其他好文 时间:
2015-03-05 13:02:13
阅读次数:
126
function percent(s, e, i){ s = Number(s), isNaN(s) && (s = "0"); var n = "%"; return e === !1 && (n = ""), parseFloat((100 * s).toFixed(i)) + n}s 需...
分类:
Web程序 时间:
2015-03-05 12:52:37
阅读次数:
139
插入排序, O(n^2), 从头到尾, 将较小的放在前面/* insertion sort ascending order */ #include int main(){ int n, array[1000], c, d, t; printf("Enter number of element...
分类:
编程语言 时间:
2015-03-05 12:36:44
阅读次数:
232
LeetCode 上不会的Reverse IntegerSingle Number II斐波那契数列 非递归算法Maximum Subarray 维持最大值Integer to RomanSort ColorsPopulating Next Right Pointers in Each Node 怎...
分类:
其他好文 时间:
2015-03-05 12:15:22
阅读次数:
161
N-Queens II问题:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions思路: 典型的DFS方法+....
分类:
其他好文 时间:
2015-03-05 12:11:36
阅读次数:
123
有一表如左图,现在需要实现查询每个组(groupid)的前两条记录。如何实现?第一种方式用unionall这个不解释。不过在高版本SQLServer中利用Row_Number()函数可以实现,语句如下:
SELECT*FROM(
SELECTROW_NUMBER()OVER(PARTITIONBYgroupidORDERBYid)ASrowid,*FROMdbo.test)xWHE..
分类:
数据库 时间:
2015-03-05 10:59:44
阅读次数:
232