解题思路:
注意事项:
参考代码:
#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 人评分
C语言程序设计教程(第三版)课后习题4.9 (C++代码)浏览:2149 |
点我有惊喜!你懂得!浏览:2074 |
点我有惊喜!你懂得!浏览:4109 |
淘淘的名单 (C语言代码)答案错误???浏览:595 |
Hello, world! (C语言代码)浏览:714 |
字符串输入输出函数 (C语言代码)浏览:2495 |
数字游戏 (C++代码)浏览:1185 |
DNA (C语言代码)浏览:741 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:810 |
老王赛马 (C++代码)浏览:905 |