摘要: 在C++中,内存分成5个区,他们分别是堆、栈、自由存储区、全局/静态存储区和常量存储区。 栈,就是那些由编译器在需要的时候分配,在不需要的时候自动清楚的变量的存储区。里面的变量通常是局部变量、函数参数等。 堆,就是那些由new分配的内存块,他们的释放编译器不去管,由我们的... 阅读全文
posted @ 2012-11-10 21:11 N3verL4nd 阅读(347) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int max(int x,int y){ return x>y?x:y;}int main(){ int (*p)(int,int); p = max; cout int lexicoCompare( const string &s1, ... 阅读全文
posted @ 2012-11-09 20:39 N3verL4nd 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 其实要理解C文件与头文件有什么不同之处,首先需要弄明白编译器的工作过程,一般说来编译器会做以下几个过程: 1.预处理阶段 2.词法与语法分析阶段 3.编译阶段,首先编译成纯汇编语句,再将之汇编成跟CPU相关的二进制码,生成各个目标文件 4.连接阶段,将各个目标文件中的各段代码进行绝对地址定位,生... 阅读全文
posted @ 2012-11-09 09:07 N3verL4nd 阅读(205) 评论(0) 推荐(0) 编辑
摘要: A Knight's Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22481 Accepted: 7598 Description Background The knigh... 阅读全文
posted @ 2012-11-08 14:09 N3verL4nd 阅读(126) 评论(0) 推荐(0) 编辑
摘要: #include int main(){ double x = 12.5; printf("%d\n",x); int y = 10; printf("%lf\n",y);} 输出: 0 0.000000 float x = 12.5; printf("%d\n", x);flo... 阅读全文
posted @ 2012-11-08 09:11 N3verL4nd 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Can you find it? Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/10000 K (Java/Others) Total Submission(s): 6083 Accepted Submiss... 阅读全文
posted @ 2012-11-07 23:33 N3verL4nd 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5387 Accepted: 3066 Description 定义一个二维数组: int maze[5][5] = { 0, 1, ... 阅读全文
posted @ 2012-11-07 16:24 N3verL4nd 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 刚学搜索,不知道剪枝的重要性。 超时代码: #include#include#includeusing namespace std;char maps[10][10];const int moves[4][2] = {{0,-1},{0,1},{1,0},{-1,0}};int m,n,t,d... 阅读全文
posted @ 2012-11-07 07:38 N3verL4nd 阅读(136) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include /*c++实现双链表的基本操作*/using namespace std;typedef struct student{ int data; struct student *pre; ... 阅读全文
posted @ 2012-11-06 13:07 N3verL4nd 阅读(136) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include /*c++实现简单的单链表操作*/using namespace std;typedef struct student{ int data; struct student *ne... 阅读全文
posted @ 2012-11-06 13:06 N3verL4nd 阅读(150) 评论(0) 推荐(0) 编辑