解题思路:
注意事项:
参考代码:#include <stdio.h>
typedef struct student
{
int id;
float score;
} student;
int main()
{
int n,k;
scanf("%d %d",&n,&k);
student a[100]= {};
for(int i=0; i<n; i++)
scanf("%d %g",&a[i].id,&a[i].score);
student temp;
for(int i=0; i<n-1; i++)
{
for(int j=0; j<n-1; j++)
if(a[j].score<a[j+1].score)
{ temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
printf("%d %g\n",a[k-1].id,a[k-1].score);
return 0;
}
0.0分
0 人评分