- 博客(9)
- 收藏
- 关注
原创 最大子序列和问题
问题描述:输入一组整数,求出这组数字子序列和中最大值。也就是只要求出最大子序列的和,不必求出最大的那个序列。例如:序列:-2 11 -4 13 -5 -2,则最大子序列和为20。 序列:-6 2 4 -7 5 3 2 -1 6 -9 10 -2,则最大子序列和为16。 int MaxSubSeqSum(int *seq, int seqSize) {
2013-11-02 13:54:11
469
原创 set all bits between i and j in N equal to M
题目:You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starti
2013-07-02 22:40:39
584
原创 整数取反
题目(来自庞果网:http://hero.pongo.cn/):完成函数reverse,要求实现把给定的一个整数取其相反数的功能,举两个例子如下: x = 123, return 321 x = -123, return -321函数实现:int reverse(int num){ int tmp = num; int result = 0; for (tmp = num; tm
2013-06-28 23:55:22
588
原创 C语言中的类型
以下摘自ANSI C标准: An object declared as type char is large enough to store any memberof the basic execution character set. If a member of the requiredsource character set enumerated in $2.2.1 is
2013-06-02 21:42:13
543
原创 C语言中的枚举
以下摘自ANSI C标准: An enumeration comprises a set of named integer constant values.Each distinct enumeration constitutes a different enumerated type.由此可见,枚举类型必然是整型常量。
2013-06-02 21:15:35
436
原创 C语言中的label
以下摘自ANSI C标准: A label name is the only kind of identifier that has function scope.It can be used (in a goto statement) anywhere in the function inwhich it appears, and is declared implicitly b
2013-06-02 16:05:55
5843
原创 C语言中的关键字
以下摘自ANSI C标准:3.1.1 KeywordsSyntax keyword: one of auto double int struct break else long switch case enum register typedef
2013-05-24 23:16:07
406
原创 C语言中的Trigraph sequences
以下对Trigraph sequences的描述摘自ANSI C标准,一般很少提到和用到。2.2.1.1 Trigraph sequences All occurrences in a source file of the following sequences ofthree characters (called trigraph sequences /5/)are replac
2013-05-23 21:16:21
644
原创 关于定义为volatile的变量
定义为volatile的变量(如volatile int i=10;)主要有两点:1.编译器不能对此变量进行优化,每次需要使用时都从存储i的地址中取值,而不是使用上次读取的保存在寄存器中的值;2.使用场景:一般如果一个变量可能被程序以外改变,可以将其定义为volatile变量。 参考:http://www.cnblogs.com/chio/archive/2007/11/24/97
2013-05-23 21:07:26
654
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人