TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

n pairwise disjoint points in the plane are given (n ≥ 3). There are n*(n−1)*(n−2)/6 triangles whose vertices
are some pairwise different points among them (including degenerate triangles, i.e. ones whose vertices are
collinear).


We want to calculate the sum of areas of all the triangles with vertices in the given points.


Those parts of the plane that belong to many triangles are to be calculated multiple times. We assume that
the area of degenerate triangles (i.e. those with collinear vertices) is zero.




Task


Write a program that:


  • reads from the standard input the coordinates of the points in the plane,

  • determines the sum of the areas of all the triangles with vertices in the given points,

  • prints out the result to the standard output.

Input Format

There are multiple test cases in the input file. For each test case:


In the first line of the standard input there is one integer n (3 ≤ n ≤ 3000) denoting the number of selected
points. Each of the following n lines contains two integers xi and yi (0 ≤ xi,yi ≤ 10000) separated by a
single space and denoting the coordinates of the i-th point (for i= 1,2, ..., n). No pair (ordered) of coordinates
appears more than once.

Output Format

For each test case please output one real number equal to the sum of the areas of all the triangles with vertices in the given points. The outcome should be printed out with exactly one digit after dot. There is no need to print any blank lines between test cases.

Sample Input 1

5
0 0
1 2
0 2
1 0
1 1

3
0 0
2 2
0 2

Sample Output 1

7.0
2.0

Hints

Problem Source

Migrated from old NTUJ.

POI 15th Stage III

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 15000 65536 200