摘要: 1 #include 2 #include 3 #include 4 5 #define N 10000 6 using namespace std; 7 8 void Merge(int *b,int *a,int i,int m,int n) 9 {10 int s = i;11 int j,k;12 //归并13 for(j=m+1,k=i;i>1;33 MergeSort(b,a,s,mid); 34 MergeSort(b,a,mid+1,t);35 Merge(b,a,s,mid,t); //... 阅读全文
posted @ 2013-08-06 22:33 crazy_apple 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 随机函数生成一个超大数组:【code】: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 int main()10 {11 freopen("random.txt","w",stdout);12 int n;13 scanf("%d",&n);14 int i;15 srand(time(NULL));16 printf("%d\n",n);17 for(i=0;i 2 #include 阅读全文
posted @ 2013-08-06 19:04 crazy_apple 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int partition(int *a,int left,int right) 8 { 9 a[0] = a[left]; //设置a[left]为主键值,存于a[0],即以a[left]值将[left,right]区间一分为二10 while(left=a[0]) right--; //从右边开始找到比主键值a[0]小的值,移到左边13 a[left]=a[right];14 while(left<right&... 阅读全文
posted @ 2013-08-06 17:31 crazy_apple 阅读(2176) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3277City HorizonTime Limit:2000MSMemory Limit:65536KTotal Submissions:15255Accepted:4111DescriptionFarmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildi 阅读全文
posted @ 2013-08-06 13:15 crazy_apple 阅读(452) 评论(0) 推荐(0) 编辑