Problem:
Score : 600 points

Problem Statement

There are N holes in a two-dimensional plane. The coordinates of the i-th hole are (x_i,y_i).

Let R=10^{10^{10^{10}}}. Ringo performs the following operation:

Randomly choose a point from the interior of a circle of radius R centered at the origin, and put Snuke there. Snuke will move to the hole with the smallest Euclidean distance from the point, and fall into that hole. If there are multiple such holes, the hole with the smallest index will be chosen.

For every i (1 \leq i \leq N), find the probability that Snuke falls into the i-th hole.

Here, the operation of randomly choosing a point from the interior of a circle of radius R is defined as follows:

Pick two real numbers x and y independently according to uniform distribution on [-R,R].

If x^2+y^2\leq R^2, the point (x,y) is chosen. Otherwise, repeat picking the real numbers x,y until the condition is met.

Constraints

2 \leq N \leq 100

|x_i|,|y_i| \leq 10^6(1\leq i\leq N)

All given points are pairwise distinct.

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
:
x_N y_N

Output

Print N real numbers. The i-th real number must represent the probability that Snuke falls into the i-th hole.

The output will be judged correct when, for all output values, the absolute or relative error is at most 10^{-5}.

Sample Input 1

2
0 0
1 1

Sample Output 1

0.5
0.5

If Ringo put Snuke in the region x+y\leq 1, Snuke will fall into the first hole. The probability of this happening is very close to 0.5.
Otherwise, Snuke will fall into the second hole, the probability of which happening is also very close to 0.5.

Sample Input 2

5
0 0
2 8
4 5
2 6
3 10

Sample Output 2

0.43160120892732328768
0.03480224363653196956
0.13880483535586193855
0.00000000000000000000
0.39479171208028279727

Solution in Go (1.6) (judge verdict: Runtime Error)

package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
  "math"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextFloatVec() []float64 {
  L := strings.Split(NextLine(), " ")
  N := make([]float64, len(L))
  for i := range N {
    N[i], _ = strconv.ParseFloat(L[i], 64)
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func Dist(mode int, A ...*[]float64) float64 {
  if len(A) < 1 { return 0.0 }
  if len(A) < 2 { A = append(A, &[]float64{0.0, 0.0}) }
  D := 0.0
  for i := range (*A[0]) {
    x := (*A[0])[i] - (*A[1])[i]
    D += x * x
  }
  if mode == 1 { D = math.Sqrt(D) }
  return D
}
func InnerProduct(A, B *[]float64) float64 {
  IP := 0.0
  for i, a := range (*A) {
    IP += a * (*B)[i]
  }
  return IP
}
func Angle(A, B *[]float64) float64 {
  acos := math.Acos(InnerProduct(A, B) / Dist(1, A) / Dist(1, B))
  theta := acos / math.Pi * 180.0
  _A := []float64{-(*A)[1], (*A)[0]}
  if InnerProduct(&_A, B) < 0 { theta = 360 - theta }
  return theta
}
func TriangleArea(A, B, C *[]float64) float64 {
  AB := []float64{(*B)[0] - (*A)[0], (*B)[1] - (*A)[1]}
  AC := []float64{(*C)[0] - (*A)[0], (*C)[1] - (*A)[1]}
  return math.Abs(AB[0] * AC[1] - AB[1] * AC[0]) / 2.0
}
func OuterCircle(A, B, C *[]float64) (X, Y, R float64) {
  AB := []float64{(*B)[0] - (*A)[0], (*B)[1] - (*A)[1]}
  AC := []float64{(*C)[0] - (*A)[0], (*C)[1] - (*A)[1]}
  AB2 := Dist(2, &AB)
  AC2 := Dist(2, &AC)
  IP := InnerProduct(&AB, &AC)
  b := AC2 * (IP - AB2) / (2 * (IP * IP - AB2 * AC2))
  c := AB2 * (IP - AC2) / (2 * (IP * IP - AB2 * AC2))
  X = (*A)[0] + AB[0] * b + AC[0] * c
  Y = (*A)[1] + AB[1] * b + AC[1] * c
  S := TriangleArea(A, B, C)
  ab := math.Sqrt(AB2)
  bc := Dist(1, B, C)
  ca := math.Sqrt(AC2)
  R = ab * bc * ca / (4 * S)
  return
}
func Less(A *[][]float64, i, j int) bool {
  if (*A)[i][0] == (*A)[j][0] { return (*A)[i][1] < (*A)[j][1] }
  return (*A)[i][0] < (*A)[j][0]
}
func Convex(A *[][]float64) []int {
  C := make([]int, 0)
  h := 0
  for i := range (*A) {
    if Less(A, h, i) { h = i }
  }
  next := h
  for len(C) == 0 || next != h {
    C = append(C, next)
    p := (*A)[next]
    for i, a := range (*A) {
      if i == next { continue }
      _A := []float64{a[0] - p[0], a[1] - p[1]}
      D1 := Dist(2, &a, &p)
      convex := true
      for j, b := range (*A) {
        if j == next || j == i { continue }
        _B := []float64{b[0] - p[0], b[1] - p[1]}
        D2 := Dist(2, &b, &p)
        theta := Angle(&_A, &_B)
        if theta < 1e-5 {
          if D2 < D1 { continue }
        } else if 180.0 <= theta {
          continue
        }
        convex = false
        break
      }
      if !convex { continue }
      next = i
      break
    }
  }
  return C
}

func Solve() {
  N := NextInt()
  A := make([][]float64, N)
  for i := range A {
    A[i] = NextFloatVec()
  }
  C := Convex(&A)
  C = append(C, C...)
  R := make([]float64, N)
  for i := 0; i < len(C) / 2; i++ {
    if C[i] == C[i + 2] {
      R[C[i + 1]] = 180.0
      continue
    }
    x, y, _ := OuterCircle(&A[C[i]], &A[C[i + 1]], &A[C[i + 2]])
    _A := []float64{A[C[i + 2]][0] - x, A[C[i + 2]][1] - y}
    _B := []float64{A[C[i]][0] - x, A[C[i]][1] - y}
    theta := Angle(&_A, &_B)
    R[C[i + 1]] = theta / 2.0
  }
  for _, r := range R {
    Write(r / 360.0)
  }
  return
}

func main() {
  Solve()
  Output()
}