摘要: 转换后的快排#include<stdio.h>#include<stdlib.h>#define MAXN 100000int a[MAXN][3];int compare(const void * x, const void * y){ if(*(int*)x > *(int*)y)return 1; else if(*(int*)x == *(int*)y) if(*((int*)x + 2) > *((int*)y + 2)) return 1; return -1;}int main(){ int n, i, j; freopen("in. 阅读全文
posted @ 2012-04-13 22:33 月之华 阅读(127) 评论(0) 推荐(0) 编辑
摘要: //快速排序+结构体#include<stdio.h>#include<stdlib.h>typedef struct{ char name[50]; float height; float weight;} person;person st[50];int compare (const void * x, const void * y){ person *xx = (person*)x; person *yy = (person*)y; if (xx->height > yy->height || (xx->height == yy->h 阅读全文
posted @ 2012-04-13 20:54 月之华 阅读(175) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>#define MAXN 200000 + 10int sort[MAXN];int compare (const void * a, const void * b){ return ( *(int*)a - *(int*)b );}int main(){ int n, i, k ; //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout);while(s 阅读全文
posted @ 2012-04-13 18:37 月之华 阅读(122) 评论(0) 推荐(0) 编辑