解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<stdlib.h>
struct student
{
long int id;
float score;
};
int main()
{
int n,i,j,k;
struct student* a;
scanf("%d %d", &n,&k);
a = (int*)malloc(n * sizeof(int));
for (i = 0; i < n; i++)
scanf("%ld %f", &a[i].id, &a[i].score);
for(i=0;i<n-1;i++)
{
for(j = 0; j < n - i - 1; j++)
{
if (a[j].score < a[j + 1].score)
{
struct student temp;
temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
printf("%ld %.1f", a[k-1].id, a[k-1].score);
free(a);
return 0;
}
0.0分
0 人评分
数列 (C++代码)浏览:664 |
汽水瓶 (C语言代码)浏览:704 |
A+B for Input-Output Practice (V) (C++代码)浏览:451 |
【明明的随机数】 (C++代码)浏览:781 |
不容易系列 (C语言代码)浏览:668 |
printf基础练习2 (C语言代码)浏览:305 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1311 |
母牛的故事 (C语言代码)浏览:944 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:1170 |
图形输出 (C语言代码)浏览:944 |