HEXIONG520 @ 2022-11-03 18:41:50
#include<bits/stdc++.h>
using namespace std;
struct studen{
int num;
int sum;
};
int main(){
int n,i,s,j,c1,c2,c3;
scanf("%d",&n);
struct studen a[n];
for(i=0;i<n;i++){
scanf("%d%d%d",&c1,&c2,&c3);
s=c1+c2+c3;
a[i].num=i+1;
a[i].sum=s;
}
int b[n];
for(i=0;i<n;i++){
b[i]=a[i].sum;
}
sort(b,b+n);
int m=0;
for(i=n-1;i>n-5-1;i--){
for(j=m;j<n;j++){
if(a[j].sum==b[i]){
printf("%d ",j+1);
printf("%d\n",b[i]);
a[j].sum=100000;
break;
}
}
}
return 0;
}
by DF_Factory @ 2022-11-03 19:05:13
@HEXIONG520 除了总分,还要按照语文成绩和学号这两个关键字排序。
by UNNN @ 2022-12-20 18:11:28
没有把语文成绩和学号排序啊,犯低级错误。