解题思路:
注意事项:
参考代码:
#include<stdio.h>
int GID(int a[],int h,int e){
int tem=a[h];
while(h<e){
while(h<e&&a[e]>=tem) e--;
a[h]=a[e];
while(h<e&&a[h]<=tem) h++;
a[e]=a[h];
}
a[h]=tem;
return h;
}
void QK(int a[],int h,int e){
if(h<e){
int index=GID(a,h,e);
QK(a,h,index-1);
QK(a,index+1,e);
}
}
int main()
{
int a[200]={0};
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
QK(a,0,n-1);
for(int m=0,i=n-1;m<10;m++,i--)
printf("%d ",a[i]);
return 0;
}
0.0分
0 人评分
点我有惊喜!你懂得!浏览:1230 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:436 |
【亲和数】 (C语言代码)浏览:542 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:617 |
兰顿蚂蚁 (C++代码)浏览:1098 |
【出圈】 (C语言代码)浏览:796 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:377 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:751 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:2081 |
WU-输出九九乘法表 (C++代码)浏览:1671 |