#include #include #include using namespace std; class point { public: point(int ax, int ay): x(ax),y(ay){ } int x; int y; }; struct PointCmp { bool operator()(const point& lhs, const point& rhs) const { return (lhs.x < rhs.x || (lhs.x == lhs.x && lhs.y <= rhs.y )); } }; int main(int argc, char** argv) { std::ios::sync_with_stdio(false); int n; while(cin >> n){ int x,y; vector points; set mnozina; int total = n*n; for(int j = 0; j < n; j++){ cin >> x >> y; for(size_t i = 0; i < points.size(); i ++){ if((abs(points[i].x - x) == abs(points[i].y - y)) && !(x == points[i].x && y == points[i].y)){ mnozina.insert(point(x,y)); mnozina.insert(point(points[i].x,points[i].y)); } } points.push_back(point(x,y)); } /*for(set::iterator it = mnozina.begin(); it != mnozina.end(); it++) cout << (*it).x << "," << (*it).y << endl; */ cout << (double)mnozina.size()/(double)total << endl; mnozina.clear(); } return 0; }