求条
查看原帖
求条
971024
Jerry_zpl楼主2025/1/12 11:19
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int maxn=1005;
bool flag[maxn][maxn];
struct node
{
	double mark;
	char id;
	double score=0;
	double answer=0;
}a[maxn];
int b[maxn][maxn];
bool check(int x,int y)
{
	if(x-y>15)
	{
		return true;
	}
	else
	{
		return false;
	}
}
bool cmp(node q,node h)
{
	if(q.answer==h.answer)
	{
		return q.id<h.id;
	}
	return q.answer>h.answer;
}
signed main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].mark>>a[i].id;
	}
	for(int i=1;i<=k;i++)
	{
		for(int j=1;j<=k;j++)
		{
			cin>>b[i][j];
		}
	}
	for(int i=1;i<=n;i++)
	{
		a[i].score=0;
		double ans=0.00;
		int l=a[i].id-'A'+1;
		memset(flag,0,sizeof(flag));
		for(int j=1;j<=k;j++)
		{
			ans+=b[j][l];
		}
		ans=ans/((double)k);
		for(int j=1;j<=k;j++)
		{
			if(check(b[j][l],ans))
			{
				flag[j][l]=true;
			}
		}
	    int  sum=0;
		for(int j=1;j<=k;j++)
		{
			if(flag[j][l]==true)
			{
				continue; 
			}
			else
			{
				sum+=b[j][l];
			}
		}
		sum=(int)round(sum/((double)k));
		a[i].score=sum;
	}
	for(int i=1;i<=n;i++)
	{
		a[i].answer=0;
	    int c=(int)round(a[i].mark*0.6+a[i].score*0.4);
	    a[i].answer=c;
	}
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++)
	{
		cout<<a[i].answer<<" "<<a[i].id;
		cout<<endl;
	}
	return 0;
}
2025/1/12 11:19
加载中...