QAQ 救救我
查看原帖
QAQ 救救我
526765
m249_chen楼主2021/10/18 17:26
#include<bits/stdc++.h>
using namespace std;
int all=0;
struct ps{
	string name;
	int anum,bnum;
	char ganbu,west;
	int wen;
	int money;
	int no;
}st[100];
bool cmp(ps x,ps y)
{
    if(x.money==y.money)return x.no<y.no;
    else return x.money>y.money;
}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>st[i].name>>st[i].anum>>st[i].bnum>>st[i].ganbu>>st[i].west>>st[i].wen;
		st[i].no=i;
	}
	for(int i=0;i<n;i++){
		if(st[i].anum>80&&st[i].wen>=1){
			st[i].money+=8000;
			all+=8000;
		}
		if(st[i].anum>85&&st[i].bnum>80){
			st[i].money+=4000;
			all+=4000;
		}
		if(st[i].anum>90){
			st[i].money+=2000;
			all+=2000;
		}
		if(st[i].anum>85&&st[i].west=='Y'){
			st[i].money+=1000;
			all+=1000;
		}
		if(st[i].bnum>85&&st[i].ganbu=='Y'){
			st[i].money+=850;
			all+=850;
		}
	}
	sort(st,st+n,cmp);
	cout<<st[0].name<<endl;
	cout<<st[0].money<<endl;
	cout<<all<<endl;
	return 0;
}

为什么我爆0了,求大佬救济。

2021/10/18 17:26
加载中...