/* * 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.util.Scanner; /** * * @author hlavaty7 */ public class Main { public static void main(String[] args) { class Cor { public Cor(int x, int y) { this.x = x; this.y = y; } int x; int y; // int bol; } Scanner sc = new Scanner(System.in); int p; Cor[] cors; while (sc.hasNext()) { p = sc.nextInt(); cors = new Cor[p]; for (int i = 0; i < p; i++) { cors[i] = new Cor(sc.nextInt(), sc.nextInt()); } 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)))); } } }