public void Solve() { if (N == 2) { Console.WriteLine("0.5\n0.5"); return; } var L = new List <Pair>(); for (int i = 0; i < N; i++) { L.Add(new Pair(X[i], Y[i], i)); } var CH = Geo.GrahamScan(L); double[] ans = new double[N]; if (CH.Count == 2) { foreach (var p in CH) { ans[p.Idx] = 0.5; } for (int i = 0; i < N; i++) { Console.WriteLine(ans[i]); } return; } int M = CH.Count; for (int i = 0; i < M; i++) { double theta = Pair.ang(CH[(i + 1) % M] - CH[i], CH[(i + M - 1) % M] - CH[i]); ans[CH[i].Idx] = (Math.PI - theta) / (2 * Math.PI); } for (int i = 0; i < N; i++) { Console.WriteLine(ans[i]); } }