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.

24 lines
773 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int a[N][5]; //二维的最后一个位置,装总分
int n;
int cnt;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d %d %d", &a[i][1], &a[i][2], &a[i][3]);
a[i][4] = a[i][1] + a[i][2] + a[i][3]; //总分
}
//每一个都与后面的每一个对比,i<n-1表示它不是最后一个这样才能和后面的对比
for (int i = 1; i < n; i++)
for (int j = i + 1; j <= n; j++) {
if ((abs(a[i][1] - a[j][1]) <= 5) && (abs(a[i][2] - a[j][2]) <= 5)
&& (abs(a[i][3] - a[j][3]) <= 5) && (abs(a[i][4] - a[j][4]) <= 10))
cnt++;
}
printf("%d\n", cnt);
return 0;
}