Files
python/TangDou/LuoGuBook/P5728.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

24 lines
773 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}