You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5 KiB
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
int main() {
int n;
while (scanf("%d", &n), n) {
pair<int, int> ps[20];
auto dis = [&](int p, int q) {
return sqrt((ps[p].first - ps[q].first) * (ps[p].first - ps[q].first) +
(ps[p].second - ps[q].second) * (ps[p].second - ps[q].second));
};
for (int i = 0; i < n; i++)
scanf("%d%d", &ps[i].first, &ps[i].second);
sort(ps, ps + n);
if(n != unique(ps, ps + n) - ps)
return -1;
vector<tuple<int, int, int>> v;
for (int i = 0; i < n; i++)
for (int j = 0; j < i; j++)
for (int k = 0; k < j; k++) {
double arr[] = {dis(i, j), dis(j, k), dis(k, i)};
sort(begin(arr), end(arr));
for (int l = 2; l >= 0; l--)
arr[l] /= arr[0];
if (arr[0] + arr[1] > arr[2] + eps)
v.push_back(make_tuple(arr[0], arr[1], arr[2]));
}
int ans = 0;
for (const auto &p:v) {
int cnt = 0;
for (const auto &q:v) {
if (abs(get<1>(p) - get<1>(q)) > eps) continue;
if (abs(get<2>(p) - get<2>(q)) > eps) continue;
cnt++;
}
ans = max(ans, cnt);
}
cout << ans << endl;
}
return 0;
}