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 C# (Mono 4.6.2.0) (judge verdict: Accepted)

using CompLib.Util;
using System;
using System.Collections.Generic;
using CompLib.Mathematics;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        P[] p = new P[n];
        for (int i = 0; i < n; i++)
        {
            p[i] = new P(sc.NextInt(), sc.NextInt());
        }

        var ch = EuclideanGeometry.ConvexHull(p);
        double[] ans = new double[n];
        for (int i = 0; i < ch.Length; i++)
        {
            P prev = p[ch[(i + ch.Length - 1) % ch.Length]];
            P cur = p[ch[i]];
            P next = p[ch[(i + 1) % ch.Length]];
            P a = next - cur;
            P b = cur - prev;
            double aa = (Math.Atan2(a.Y, a.X) - Math.Atan2(b.Y, b.X)) / (Math.PI * 2);
            if (aa < 0) aa += 1;
            ans[ch[i]] = aa;
        }

        Console.WriteLine(string.Join("\n", ans));
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Mathematics
{
    using Num = Double;

    public class EuclideanGeometry
    {
        private const Num Eps = (Num) 1e-10;

        public static Num Add(Num l, Num r)
        {
            if (Math.Abs(l + r) < Eps * (Math.Abs(l) + Math.Abs(r))) return 0;
            return l + r;
        }

        public static bool Equal(Num l, Num r)
        {
            return Math.Abs(l - r) < Eps * (Math.Abs(l) + Math.Abs(r));
        }

        /// <summary>
        /// 線分l上に点pがあるか?
        /// </summary>
        /// <param name="l"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static bool OnSegment(Segment l, P p)
        {
            // pを原点に移動
            // pが直線l上にある かつ 内積が負
            return (l.A - p).Det(l.B - p) == 0 && (l.A - p).Dot(l.B - p) <= 0;
        }

        /// <summary>
        /// 直線 l,rの交点 l,rが並行なら false
        /// </summary>
        /// <param name="l"></param>
        /// <param name="r"></param>
        /// <returns></returns>
        public static bool Intersection(Line l, Line r, out P p)
        {
            var t = (r.B - r.A).Det(l.B - l.A);
            // t == 0 l,rが並行
            if (t < Eps)
            {
                p = new P();
                return false;
            }

            p = l.A + (l.B - l.A) * ((r.B - r.A).Det(r.A - l.A) / t);
            return true;
        }

        // 凸包
        public static int[] ConvexHull(P[] ps, List<P> result = null)
        {
            int n = ps.Length;
            var tup = new Tuple<P, int>[n];
            for (int i = 0; i < n; i++)
            {
                tup[i] = new Tuple<P, int>(ps[i], i);
            }

            Array.Sort(tup,
                (l, r) => Equal(l.Item1.X, r.Item1.X)
                    ? l.Item1.Y.CompareTo(r.Item1.Y)
                    : l.Item1.X.CompareTo(r.Item1.X));

            var qs = new Tuple<P, int>[2 * n];
            int k = 0;

            // 下側
            for (int i = 0; i < n; i++)
            {
                while (k > 1 && (qs[k - 1].Item1 - qs[k - 2].Item1).Det(tup[i].Item1 - qs[k - 1].Item1) <= 0) k--;
                qs[k++] = tup[i];
            }

            // 上側
            for (int i = n - 2, t = k; i >= 0; i--)
            {
                while (k > t && (qs[k - 1].Item1 - qs[k - 2].Item1).Det(tup[i].Item1 - qs[k - 1].Item1) <= 0) k--;
                qs[k++] = tup[i];
            }

            int[] res = new int[k - 1];
            for (int i = 0; i < k - 1; i++)
            {
                res[i] = qs[i].Item2;
            }

            if (result != null)
            {
                for (int i = 0; i < k - 1; i++)
                {
                    result.Add(qs[i].Item1);
                }
            }

            return res;
        }
    }

    /// <summary>
    /// 直線 a-b
    /// </summary>
    public struct Line
    {
        public readonly P A, B;

        public Line(P a, P b)
        {
            A = a;
            B = b;
        }

        public Line(Num aX, Num aY, Num bX, Num bY)
        {
            A = new P(aX, aY);
            B = new P(bX, bY);
        }

        public Line(Segment s)
        {
            A = s.A;
            B = s.B;
        }
    }

    /// <summary>
    /// 線分 a-b
    /// </summary>
    public struct Segment
    {
        public readonly P A, B;

        public Segment(P a, P b)
        {
            A = a;
            B = b;
        }

        public Segment(Num aX, Num aY, Num bX, Num bY)
        {
            A = new P(aX, aY);
            B = new P(bX, bY);
        }

        public Line ToLine()
        {
            return new Line(A, B);
        }
    }

    // 2次元ベクトル
    public struct P
    {
        public readonly Num X, Y;

        public P(Num x, Num y)
        {
            X = x;
            Y = y;
        }

        public static P operator +(P l, P r)
        {
            return new P(EuclideanGeometry.Add(l.X, r.X), EuclideanGeometry.Add(l.Y, r.Y));
        }

        public static P operator -(P l, P r)
        {
            return new P(EuclideanGeometry.Add(l.X, -r.X), EuclideanGeometry.Add(l.Y, -r.Y));
        }

        public static P operator *(P l, Num r)
        {
            return new P(l.X * r, l.Y * r);
        }

        /// <summary>
        /// 内積 l * r = |l|*|r|*cosθ
        /// </summary>
        /// <returns></returns>
        public Num Dot(P r)
        {
            return EuclideanGeometry.Add(X * r.X, Y * r.Y);
        }

        /// <summary>
        /// 外積 l * r = |l|*|r|*sinθ
        /// </summary>
        /// <param name="r"></param>
        /// <returns></returns>
        public Num Det(P r)
        {
            return EuclideanGeometry.Add(X * r.Y, -Y * r.X);
        }
    }
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}