You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
691 B
33 lines
691 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
const int N = 1100;
|
|
struct Student {
|
|
string name;
|
|
int x;
|
|
int y;
|
|
int z;
|
|
int sum;
|
|
} a[N];
|
|
int n;
|
|
|
|
void check(Student p, Student q) {
|
|
if (abs(p.x - q.x) <= 5 && abs(p.y - q.y) <= 5 && abs(p.z - q.z) <= 5 &&
|
|
abs(p.sum - q.sum) <= 10) {
|
|
cout << p.name << " " << q.name << endl;
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> a[i].name >> a[i].x >> a[i].y >> a[i].z;
|
|
a[i].sum = a[i].x + a[i].y + a[i].z;
|
|
}
|
|
|
|
for (int i = 1; i < n; i++)
|
|
for (int j = i + 1; j <= n; j++)
|
|
check(a[i], a[j]);
|
|
return 0;
|
|
} |