请问哪位大神能帮我看一下代码吗?和测试点1的答案一样但没过(没超时
查看原帖
请问哪位大神能帮我看一下代码吗?和测试点1的答案一样但没过(没超时
1098255
Savior20100921楼主2024/6/15 21:27
#include<bits/stdc++.h>
using namespace std;
int n;
struct node{
	char name[30],gb,xb;
	int qm,bj,lw;
	int h=0,p=0;
}ren[110]; 
int ans=0;
int bb(int x,int y)
{
	if(x>85&&y>80)return 4000;
	else return ans; 
}
int cc(int x)
{
	if(x>90)return 2000;
	else return ans;
}
int d(int &x,char &y)
{
	if(x>85&&y=='Y')return 1000;
	else return ans;
}
int e(int x,char y)
{
	if(x>80&&y=='Y')return 850;
	return ans;
}
bool cmp(const node &x,const node &y)
{
	return x.h>y.h;
 } 
bool cmp2(const node &x,const node &y)
{
	return x.p<y.p;
 } 
int main()
{
	//freopen("a.out","w",stdout);
	scanf("%d",&n); 
	for(int i=1;i<=n;i++)
	{
		int a,b,c;
		char A,B,k,kk;
		scanf("%s",ren[i].name);
		scanf("%d%d%c%c%c%c%d",&a,&b,&k,&A,&kk,&B,&c);
		ren[i].qm=a;ren[i].bj=b;ren[i].gb=A;ren[i].xb=B;ren[i].lw=c;
		ren[i].p=i;
		if(ren[i].qm>80&&ren[i].lw>=1)ren[i].h+=8000;
		ren[i].h+=bb(ren[i].qm,ren[i].bj);
		ren[i].h+=cc(ren[i].qm);
		ren[i].h+=d(ren[i].qm,ren[i].xb);
		if(ren[i].bj>80&&A=='Y')ren[i].h+=850;
	}
	sort(ren+1,ren+1+n,cmp);
	int l=1;
	for(int i=1;i<=l;i++)
	{
		if(ren[i].h==ren[i+1].h)l++;
		else break;
	}
	if(l!=1)
	sort(ren+1,ren+l+1,cmp2);
	printf("%s\n%d\n",ren[1].name,ren[1].h);
	int hh;
    for(int i=1;i<=n;i++)
    {
    	hh+=ren[i].h;
	}
	printf("%d",hh);
	return 0;
}
2024/6/15 21:27
加载中...