清龍


私信TA

用户名:uq_72618500813

访问量:657

签 名:

等  级
排  名 836
经  验 3528
参赛次数 0
文章发表 6
年  龄 0
在职情况 学生
学  校 自修大学
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

#include <stdio.h>

struct Student {

int id;

float score;

};

int main(){

int n,m;

scanf("%d %d",&n,&m);

struct Student student[n];

for(int i=0;i<n;i++){

scanf("%d %f",&student[i].id,&student[i].score);

}

for(int i=0;i<n-1;i++){

for(int j=0;j<n-i-1;j++){

if(student[j].score<student[j+1].score){

int temId = student[j].id;

float temScore = student[j].score;

student[j].id = student[j+1].id;

student[j].score = student[j+1].score;

student[j+1].id = temId;

student[j+1].score = temScore;

}

}

}

printf("%d %g",student[m-1].id,student[m-1].score);

}


 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区