/* * 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. */ import java.io.*; import java.io.BufferedReader; import java.io.InputStreamReader; /** * * @author cteam056 */ // předělat na Main class Main { public static BufferedReader in; private static String line; private static int[][] monsters; private static String [][] strMonsters; private static int N; /** * @param args the command line arguments * @throws java.io.IOException */ public static void main(String[] args) throws IOException { // TODO code application logic here in = new BufferedReader(new InputStreamReader(System.in)); while((line = in.readLine()) != null && !line.isEmpty()) { N = Integer.parseInt(line); monsters = new int[N][2]; strMonsters = new String[N][2]; for(int j = 0; j < N; j++) { line = in.readLine(); strMonsters[j] = line.split(" "); for(int i = 0; i < 2; i++) { monsters[j][i] = Integer.parseInt(strMonsters[j][i]); } } System.out.println(seradMonstra()); } } private static double seradMonstra() { double p = 0; int a, b; for(int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { a = monsters[i][0] - monsters[j][0]; b = monsters[i][1] - monsters[j][1]; if (myAbs(a) == myAbs(b)) { p += 2; } } } return p / (N * N); } private static int myAbs(int a) { return (a < 0) ? a * -1 : a; } }