#include <bits/stdc++.h> #define per(i,a,b) for(int i=a;i<b;i++) using namespace std; const int maxn(1e4 + 7); int n; long long x[maxn], y[maxn]; double ans; int dex; int main() { while (cin >> n) { if (n == 3) { n = 3; } per(_, 1, n + 1) { cin >> x[_] >> y[_]; } dex = 0; per(i, 1, n + 1) { ans = 0; per(j, 1, n + 1) { if (i != j) { if (ans == 0) { ans = sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])); } else if (sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) != ans) { break; } else { if (j == n || (i == n && j == n - 1)) { dex = i; break; } } } } if (dex) { break; } } if (!dex) { dex = -1; } cout << dex << endl; } } |
Double click to view unformatted code.