【luogu1051】谁拿了最多奖学金 模拟
程序员文章站
2024-01-07 20:18:22
...
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
struct node{string s;int mark,cls,p,v,id;char west,cadre;}a[1001];
int n,m,ToT;
bool judge1(node x){return (x.mark>80&&x.p>=1);}
bool judge2(node x){return (x.mark>85&&x.cls>80);}
bool judge3(node x){return (x.mark>90);}
bool judge4(node x){return (x.mark>85&&x.west=='Y');}
bool judge5(node x){return (x.cls>80&&x.cadre=='Y');}
bool cmp(node x,node y){return x.v==y.v?x.id<y.id:x.v>y.v;}
int main() {
cin>>n;
for (int i=1;i<=n;i++) {cin>>a[i].s>>a[i].mark>>a[i].cls>>a[i].cadre>>a[i].west>>a[i].p;a[i].id=i;}
for (int i=1;i<=n;i++) {
if (judge1(a[i])) a[i].v+=8000;
if (judge2(a[i])) a[i].v+=4000;
if (judge3(a[i])) a[i].v+=2000;
if (judge4(a[i])) a[i].v+=1000;
if (judge5(a[i])) a[i].v+=850;
ToT+=a[i].v;
}
sort(a+1,a+1+n,cmp);
cout<<a[1].s<<endl<<a[1].v<<endl<<ToT<<endl;
return 0;
}