/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package northwest; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author hlavaty7 */ public class Main { public static void main(String[] args) throws IOException { class Cor { public Cor(int x, int y) { this.x = x; this.y = y; } int x; int y; // int bol; } BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); int p; Cor[] cors; String line; while ((line = sc.readLine()) != null) { p = Integer.parseInt(line.trim()); cors = new Cor[p]; for (int i = 0; i < p; i++) { String[] pom = sc.readLine().split(" "); cors[i] = new Cor(Integer.parseInt(pom[0]), Integer.parseInt(pom[1])); } double vysl = 0; for (int i = 0; i < p; i++) { for (int j = 0; j < p; j++) { if (i != j) { if ((cors[i].x < cors[j].x && cors[i].y < cors[j].y) || (cors[i].x > cors[j].x && cors[i].y < cors[j].y)) { int sumX = Math.abs(cors[i].x - cors[j].x); int sumY = Math.abs(cors[i].y - cors[j].y); if (sumX == sumY) { vysl = vysl + 2; } } // if ((cors[i].x > cors[j].x && cors[i].y > cors[j].y) || (cors[i].x < cors[j].x && cors[i].y > cors[j].y)) { // int sumX = Math.abs(cors[i].x - cors[j].x); // int sumY = Math.abs(cors[i].y - cors[j].y); // if (sumX == sumY) { // // vysl++; // } // } } } } System.out.println(((vysl) / ((double) (p * p)))); } } }