eolymp
bolt
Try our new interface for solving problems
Problems

Circum Triangle

Circum Triangle

You are given $n$ distinct points on the boundary of a circle with radius $r$ whose center is at the origin. As the points are on the same circle no three of them are collinear, so any three of them creates a valid triangle. Your job is to find the summation of areas of these triangles. \InputFile Contains at most $16$ tests. Each test starts with two integers $n\:(0 \le n \le 500)$ and $r\:(0 < r \le 100)$. Here $n$ is the number of points and $r$ is the radius of the circle. You can assume that the center of the circle is always at the origin. This line is followed by $n$ lines each of which contains a floating-point number $θ\:(0.0 \le θ < 360.00)$ which actually denotes the angle in degree the designated point creates with respect to the origin with $x$-axis. So, for example if $θ$ is $30.00$ degree then the Cartesian coordinate of the intended point is $(r \cdot cos(30.00°), r \cdot sin(30.00°))$. The last line contains $n = r = 0$ and is not processed. \OutputFile For each test case print one line. This line contains an integer which is the total area (rounded to the nearest integer) of all possible triangles formed by the given $n$ points.
Time limit 1 second
Memory limit 128 MiB
Input example #1
5 10
10.00
100.00
300.00
310.00
320.00
3 20
10.00
100.00
300.00
0 0
Output example #1
286
320