摘要: 1 % ****************************************************************************** 2 % --------------------------------------------------------... 阅读全文
posted @ 2015-03-13 00:01 qinpan 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 给一个数组,元素都是整数(有正数也有负数),寻找连续的元素相加之和为最大的子序列例如a={1,-2,3,5,-4,6};最大和子序列是3,5,-4,6 要求算法复杂度为O(n)。(子序列为任意几个连续的元素)View Code 1 #include <iostream> 2 using namespace std; 3 int iL,iR;//iL是记录从左边扫描,当遇到sumL<0时继续扫描的第一个正数的下标,iR同理 4 int find(int array[] , int n) 5 { 6 int i , max , sum; 7 sum = max = array[0 阅读全文
posted @ 2012-10-28 10:57 qinpan 阅读(430) 评论(0) 推荐(0) 编辑
摘要: 网上有许多硬盘安装的教程。基本工作都一样的。准备工作:CentOS 6.3 i386 ISO文件;grub;足够的自由空间;和一个FAT格式分区把grub中的 grldr, menu.lst 、grub.exe拷到C盘 , ISO的第一个镜像文件里的isolinux的vmlinuz 、initrd 文件拷到FAT分区中,然后是修改c:\boot.ini 在boot.ini的最后一行加上C:\grldr="start grub" 并把timeout=0改成 timeout=8然后是menu.lst编写:1 title xxx2 3 root (hd0,3) 4 5 #(hd0 阅读全文
posted @ 2012-10-26 19:09 qinpan 阅读(2751) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdlib> 3 #include <vector> 4 #include <string> 5 #include <cstring> 6 #include <ctime> 7 #include <cstdio> 8 #include <algorithm> 9 #include <numeric> 10 //#include "Student.h" 11 //#include "Sor 阅读全文
posted @ 2012-10-23 21:30 qinpan 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 1 #include <string> 2 #include <list> 3 #include <vector> 4 #include <deque> 5 #include <iomanip> 6 #include <iostream> 7 8 void display(int *a,int n) 9 {//n为数组个数 10 for(int i=0;i<n;++i) 11 { 12 cout <<setw(3)<< a[i]<<"#"; 13 } 14 co 阅读全文
posted @ 2012-10-08 00:18 qinpan 阅读(198) 评论(0) 推荐(0) 编辑