必须要sort
```
#include<bits/stdc++.h>
using namespace std;
struct node{
int qm,py,lv,jxj,id;
char gb,xb;
string name;
}a[100005];
bool cmp(node a,node b){
if(a.jxj!=b.jxj) return a.jxj>b.jxj;
else return a.id<b.id;
}
int main()
{
int n,sumj=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i].name>>a[i].qm>>a[i].py>>a[i].gb>>a[i].xb>>a[i].lv;
a[i].id=i;
if(a[i].qm>80 && a[i].lv>=1){
a[i].jxj+=8000;
}if(a[i].qm>85 && a[i].py>80){
a[i].jxj+=4000;
}if(a[i].qm>90){
a[i].jxj+=2000;
}if(a[i].qm>85 && a[i].xb=='Y'){
a[i].jxj+=1000;
}if(a[i].py>80 && a[i].gb=='Y'){
a[i].jxj+=850;
}
}
sort(a+1,a+n+1,cmp);
cout<<a[1].name<<endl;
cout<<a[1].jxj<<endl;
for(int i=1;i<=n;i++){
sumj+=a[i].jxj;
}
cout<<sumj;
return 0;
}
```
by Razer_System @ 2024-01-08 20:31:23
@[jzy2011](https://www.luogu.com.cn/user/1034698)
by Razer_System @ 2024-01-08 20:32:06
@[jzy2011](/user/1034698)
```cpp
if(x>80 && a=='Y')sum+=850;
```
改成:
```cpp
if(y>80 && a=='Y')sum+=850;
```
by xiaoshumiao @ 2024-01-08 20:33:19
@[Razer_System](/user/766788) 为什么要 sort。
by xiaoshumiao @ 2024-01-08 20:33:42
@[xiaoshumiao](https://www.luogu.com.cn/user/1008513) 每个人有自己喜欢的方法,~~不sort好像确实也可以~~
by Razer_System @ 2024-01-08 20:37:12
@[xiaoshumiao](/user/1008513) 感谢,过啦
by jzy2011 @ 2024-01-08 21:05:51
@[Razer_System](/user/766788) 为什么要sort?
by 3_14 @ 2024-01-18 21:57:51
@[3_14](https://www.luogu.com.cn/user/913288) 请注意看前面的回复
by Razer_System @ 2024-01-19 08:01:43