SDUT 2109 找女朋友
来源:互联网 发布:大数据分析软件 编辑:程序博客网 时间:2024/04/29 01:05
链接 : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2109
1 #include<stdio.h> 2 int a[100000],temp; 3 int main() 4 { 5 int sort(int i,int j,int *a); 6 int i,j,n; 7 scanf("%d",&n); 8 for(i = 0;i < n; i++) 9 scanf("%d",&a[i]); 10 sort(0,n-1,a); 11 printf("%d",a[0]); 12 for(i = 1;i < n; i++) 13 printf(" %d",a[i]); 14 printf("\n"); 15 return 0; 16 } 17 int sort(int i,int j,int *a) 18 { 19 if(i == j) return 0; 20 int h = i,t = j,mark = 0; 21 for(;i != j;) 22 { 23 if(mark % 2 == 0) 24 { 25 if(a[i] < a[j]) {mark = 1;temp = a[i];a[i] = a[j];a[j] = temp;} 26 else j--; 27 } 28 else 29 { 30 if(a[j] > a[i]) {mark = 0;temp = a[i];a[i] = a[j];a[j] = temp;} 31 else i++; 32 } 33 } 34 if(i == h) sort(i+1,t,a); 35 else if(i == t) sort(h,i-1,a); 36 else 37 { 38 sort(h,i-1,a); 39 sort(i+1,t,a); 40 } 41 }
- SDUT 2109 找女朋友
- 找女朋友 SDUT(2109)
- SDUT OJ 2109 找女朋友
- sdut oj2109 找女朋友(快排)
- SDUOJ---2109找女朋友
- 2109-找女朋友
- CSDN(2109)找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- 找女朋友
- SDUT 216 数据结构实验之二叉树的建立与遍历
- SDUT 2129 树结构练习——判断给定森林中有多少棵树
- 技术架构师要有责任心
- mac首次登陆操作
- 哈夫曼树 SDUT 2127
- SDUT 2109 找女朋友
- Poj 1753 Flip Game 状态压缩 + DFS
- 重叠IO模型
- BFS + 状态压缩 POJ 2965 The Pilots Brothers' refrigerator
- POJ 1062 昂贵的聘礼
- POJ2253 Frogger
- POJ1789 Truck History 最小生成树 + 路径压缩
- POJ 3026 Borg Maze 普利姆 + BFS
- POJ 3041 Asteroids