赛尔超级英雄吧 关注:9,086贴子:131,374
  • 1回复贴,共1


来自Android客户端1楼2022-04-23 19:36回复
    #include <stdio.h>
    int main(){
    int i,j,k,l,m;
    int n = 20;
    int a[20] = {6,7,8,9,10,15,14,13,12,11,8,9,15,14,13,15,14,3,2,1};
    {
    for (i = 0; i <19; i++)
    {
    for (k = i + 1; k < n; k++)
    {
    if (a[i] == a[k])
    {
    for (int j= k; j < n - 1; j++)
    {
    a[j] = a[j + 1];
    }
    }
    }
    }for(i=0;i<19;i++)
    {
    j = i;
    for(k=i+1;k<20;k++)
    if(a[k] > a[j]) j = k;
    if(j!=i)
    {
    l= a[i];
    a[i] = a[j];
    a[j] = l;
    }
    }
    for(m=0;m<5;m++)
    printf("%d ",a[m]);
    }
    return 0;
    }


    IP属地:广东来自Android客户端2楼2022-05-31 20:15
    回复