#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct{ long name; float chenji; }stack; int main(){ stack students[100]; int size,z; scanf("%d %d",&size,&z); for(int i=0;i<size;i++){ scanf("%ld %f",&students[i].name,&students[i].chenji); } stack temp; for (int i = 0; i < size-1; i++) { for (int j = 0; j < size-i-1; j++) { if (students[j].chenji < students[j+1].chenji) { temp = students[j]; students[j] = students[j+1]; students[j+1] = temp; } } } printf("%ld %g\n",students[z-1].name,students[z-1].chenji); return 0; }
解题思路:
注意事项:
参考代码:
0.0分
0 人评分