博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年8月11日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1171我错在这里把int c1[max];int c2[max];int value[51];int count[51];放在main函数里面,结果导致stack overflow 栈溢出,但放在main函数外面作为全局变量就不会。这是因为函数的内存在开在栈上的,全局变量内存在堆上分配。前者远小于后者View Code 1 #include<cstdio> 2 #include<cstring> 3 4 #define max 250010 5 6 int c1[max]; 7 int 阅读全文

posted @ 2012-08-11 16:44 皇星客栈--Linux 阅读(238) 评论(0) 推荐(0) 编辑

摘要: 万变不离其中,只是我最后少考虑一种情况,如果i==num+1的情况!!!!!!!http://acm.hdu.edu.cn/showproblem.php?pid=1085View Code 1 #include<stdio.h> 2 3 #define max 80001 4 5 int main( ) 6 { 7 int i; 8 int j; 9 int c1[max];10 int c2[max];11 int num_1;12 int num_2;13 int num_3;14 int num;15 whi... 阅读全文

posted @ 2012-08-11 00:38 皇星客栈--Linux 阅读(151) 评论(0) 推荐(0) 编辑