回调的形式因程序设计语言的不同而不同:1。 C、C++和Pascal允许将函数指针作为参数传递给其它函数。JavaScript,Python,Perl和PHP允许简单的将函数名作为参数传递。2。 .NET Framework的语言中,提供了一种型别安全的引用封装,所谓的'委托',用来定义包含类型的函...
分类:
其他好文 时间:
2014-11-09 00:50:36
阅读次数:
148
%@ 对象%d, %i 整数%u 无符整形%f 浮点/双字%x, %X 二进制整数%o 八进制整数%zu size_t%p 指针%e 浮点/双字 (科学计算)%g 浮点/双字%s C 字符串%.*s Pascal字符串%c 字符%C unichar%lld 64位长整数(long long)%llu...
分类:
其他好文 时间:
2014-11-08 23:27:55
阅读次数:
236
【树状数组】段修改,点查询
利用差分,先得到一个差分序列(如:(1,2,3,5)的差分序列为(1,1,1,2))
当[i,j]段中所有数均加上数m时,在差分序列的i位置加上m,在j+1位置减去m即可
求和利用树状数组...
分类:
编程语言 时间:
2014-11-08 20:54:10
阅读次数:
267
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use...
分类:
其他好文 时间:
2014-11-08 10:26:18
阅读次数:
173
Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,...
分类:
其他好文 时间:
2014-11-08 10:23:23
阅读次数:
194
Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(...
分类:
其他好文 时间:
2014-11-06 16:41:45
阅读次数:
165
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
分类:
其他好文 时间:
2014-11-06 16:27:43
阅读次数:
182
C#常用的命名规则Pascal 规则每个单词开头的字母大写(如 TestCounter).Camel 规则除了第一个单词外的其他单词的开头字母大写. 如. testCounter.Upper 规则仅用于一两个字符长的常量的缩写命名,超过三个字符长度应该应用Pascal规则.例如:public cla...
没readkey的情况type Tstring=record s:array[0..maxn] of char; n:longint; end;procedure scan(var S:Tstring);beginS.n:=0; while not seekeoln do with S...
分类:
其他好文 时间:
2014-11-02 18:09:43
阅读次数:
194
对于第2个pascal triangle,通过观察可以发现,其实只需要2个额外的变量来记录,于是就设了个tmp数组。整体有点DP问题中的滚动数组的感觉。 1 #include 2 #include 3 using namespace std; 4 5 class Solution { 6 pu...
分类:
其他好文 时间:
2014-11-02 17:48:31
阅读次数:
193