3 条题解
-
0
njnu26190415 LV 7 @ 3 年前
用c++11的容器和容器算法不需要动什么脑筋儿
-
04 年前@
不会有人用纯数组吧,震惊我一百年
-
05 年前@
#include <stdio.h>
struct student
{
int id;
int score;
};
int main()
{
struct student t,stu[100000];
int i,j,n,k;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d%d",&stu[i].id,&stu[i].score);
for(i=1;i<n;i++)
for(j=i-1;j>=0;j--)
{
if(stu[j].score<stu[j+1].score)
{
t=stu[j];
stu[j]=stu[j+1];
stu[j+1]=t;
}
if(stu[j].score==stu[j+1].score)
{
if(stu[j].id>stu[j+1].id)
{
t=stu[j];
stu[j]=stu[j+1];
stu[j+1]=t;
}
}
}
printf("%d %d\n",stu[k-1].id,stu[k-1].score);
return 0;
}
- 1
信息
- 难度
- 7
- 分类
- (无)
- 标签
- 递交数
- 428
- 已通过
- 77
- 通过率
- 18%
- 被复制
- 9
- 上传者