#include #include #include #include #include #include #include using namespace std; int pNwID[100001], pNeID[100001], pNwCount[100001], pNeCount[100001]; class Pt { public: Pt(int x=0, int y=0, int i=0) { this->x = x; this->y = y; this->ID = i; } bool IsNW(const Pt& o) { int dx = x - o.x; int dy = y - o.y; if ((dx == 0) || (dy == 0)) { return false; } return dx == dy; } bool IsNE(const Pt& o) { int dx = x - o.x; int dy = y - o.y; if ((dx == 0) || (dy == 0)) { return false; } if (abs(dx) == abs(dy)) { bool pos = false; bool neg = false; if (dx < 0) { neg = true; } else { pos = true; } if (dy < 0) { neg = true; } else { pos = true; } return (pos == true) && (pos == neg); } return false; } bool operator==(const Pt& o) { return (x == o.x) && (y == o.y); } bool operator<(const Pt& o) { return (x < o.x) || ((x == o.x) && (y < o.y)); } friend inline bool operator<(const Pt& a, const Pt& b) { return (a.x < b.x) || ((a.x == b.x) && (a.y < b.y)); } int x, y; int ID; }; int main() { int count; while (scanf_s("%d", &count) == 1) { //vector vals; //vals.reserve(count); set nW, nE; for (int i = 0; i < count; ++i) { int x, y; scanf_s("%d %d", &x, &y); Pt p(x, y, i); pNeID[i] = i; pNwID[i] = i; pNwCount[i] = pNeCount[i] = 1; bool add = false; for (auto a : nW) { if (a.IsNW(p)) { add = true; pNwCount[a.ID]++; break; } } if (!add) { nW.insert(p); } add = false; for (auto a : nE) { if (a.IsNE(p)) { add = true; pNeCount[a.ID]++; break; } } if (!add) { nE.insert(p); } } int mySum = 0; for (auto a : nW) { //mySum += pNwCount[a.ID]; mySum += pNwCount[a.ID] * (pNwCount[a.ID] - 1) / 2; } for (auto a : nE) { mySum += pNeCount[a.ID] * (pNeCount[a.ID] - 1) / 2; } double res = round((static_cast(mySum * 2) / static_cast(count * count)) * 1000000); long r2 = static_cast(res); while (r2 % 10 == 0) { r2 /= 10; } printf("0.%d\n", r2); } } static double solve(const vector& pts) { }