import java.io.*; import java.util.*; import java.awt.geom.*; /** * Try considering all possible orders to traverse the lines in to form * a polygon. Use floating point arithmetic with an appropriately chosen * epsilon value to detect when computed intersection points correspond * to the same point. * * @author Finn Lidbetter */ public class findingpolly_finn_faster { static double EPS = 1e-12; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); Line[] lines = new Line[n]; for (int i=0; i0); // We double counted reversals. System.out.println(count/2); } static int nextPermutation(int[] c) { int first = getFirst(c); int retVal = first; if (first == -1) return retVal; int toSwap = c.length - 1; while (c[first] >= c[toSwap]) --toSwap; swap(c, first++, toSwap); toSwap = c.length - 1; while (first < toSwap) swap(c, first++, toSwap--); return retVal; } static int getFirst(int[] c) { for (int i = c.length - 2; i >= 0; --i) if (c[i] < c[i + 1]) return i; return -1; } static void swap(int[] c, int i, int j) { int tmp = c[i]; c[i] = c[j]; c[j] = tmp; } static int maxValidIndex(int[] order, Point2D[][] intersections, int minSwapIndex, int currMaxValid) { int n = order.length; Point2D[] pts = new Point2D.Double[n]; Line2D[] segments = new Line2D.Double[n]; if (minSwapIndex-21) { Point2D refPt = intersections[order[0]][order[i]]; if (refPt!=null && intersects(segments[i], segments[0], refPt)) { return currMaxValid; } } } // Validate each new segment against everything that comes before it. for (int i=currMaxValid+1; i