```cpp
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
struct str
{
char x[10];
int c;
int m;
int e;
int s;
};
void Input(int n, str student[]);
int Is(str student[], int i, int j);
int main()
{
int n,flag=0;
str student[1001];
cin >> n;
Input(n, student);
for (int i = 0; n > i; i++)
{
for (int j = i+1; n > j; j++)
{
if (Is(student,i,j))
{
if (flag == 1)
cout << endl;
cout << student[i].x << ' ' << student[j].x;
flag = 1;
}
}
}
return 0;
}
void Input(int n, str student[])
{
for (int i = 0; n > i; i++)
{
cin >> student[i].x >> student[i].c >> student[i].m >> student[i].e;
student[i].s= student[i].c +student[i].m +student[i].e;
}
}
int Is(str student[],int i, int j)
{
if (abs(student[i].c - student[j].c) <= 5 && abs(student[i].m - student[j].m) <= 5 && abs(student[i].e - student[j].e) <= 5 && abs(student[i].s - student[i].s) <= 10)
return 1;
return 0;
}
全WA,求助,SOS