caitou007 @ 2022-03-18 14:46:34
分数相同那个序号我解决不了,求大佬教教我
#include<bits/stdc++.h>
using namespace std;
struct cp{
int g;
int c,m,e;
}a[99999];
int sum[99999];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
a[i].g=i;
cin>>a[i].c>>a[i].m>>a[i].e;
sum[i]=a[i].c+a[i].m+a[i].e;
}
sort(sum+1,sum+n+1,greater<int>());
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(sum[i]==a[j].c+a[j].m+a[j].e){
a[i].g=j;
}
}
}
for(int i=1;i<=5;i++){
cout<<a[i].g<<" "<<sum[i]<<endl;
}
}
by _wakeup @ 2022-07-19 16:11:17
我是手写的判断函数
int pd(node a,node b)
{
return a.zong>b.zong;
return a.yu>b.yu;
return a.hao>b.hao;
}