建议降红,难度还行
查看原帖
建议降红,难度还行
383027
Torbllino楼主2023/3/22 15:41
#include<bits/stdc++.h> 
using namespace std;
struct node
{
	string name;
	int a,b,c,s = 0;
} st[1005];
int n;
bool cmp(int x,int y);
int main()
{
	cin>>n;
	for(int i = 1;i <= n;i++)
	{
		cin>>st[i].name>>st[i].a>>st[i].b>>st[i].c;
		st[i].s = st[i].a + st[i].b + st[i].c;
	}
	for(int i = 1;i <= n;i++)
	{
		for(int j = i + 1;j <= n;j++)
		{
			if(cmp(i,j)) cout<<st[i].name<<" "<<st[j].name<<endl;
		}
	}
	return 0;
} 
bool cmp(int x,int y)
{
	if(abs(st[x].a - st[y].a) <= 5 && abs(st[x].b - st[y].b) <= 5 && abs(st[x].c - st[y].c) <= 5 && abs(st[x].s - st[y].s) <= 10) return true;
	else return false;
}
2023/3/22 15:41
加载中...