3690 - Star Area

Created by Alfredo Fundora Rolo
Added by alfredo12345 (2016-06-13)
Limits
Total Time: 3000 MS | Test Time: 1000 MS |Memory: 256 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

Along a circle of radius R, we lay out N points such that every pair of neighboring points has the same distance. Then, we draw line segments connecting each pair of points that are separated by exactly one other point. Notice that each segment will be crossed by two other segments and, therefore, is divided into three sub-segments. For example, here is a drawing for N = 6:


If we then erase the circle and the internal sub-segments that lie between two crossings, we obtain a star-shaped polygon with N tips (spikes). For N = 6, the picture looks as follows:


Compute the area of the resulting star-shaped polygon.
A lo largo de un círculo de radio R se ubican N puntos de modo que cualquier par de puntos vecinos se encuentren a una misma distancia. Luego, se trazan segmentos de recta que unen todos los pares de puntos que están separados exactamente por un solo punto. Cada segmento quedará dividido en tres partes por otros dos segmentos. A continuación se muestra la figura para N = 6:


Si se eliminan el círculo y los segmentos internos que se encuentran entre dos divisiones, se obtiene un polígono en forma de estrella con N puntas. Para N = 6, la figura resultante se ve como sigue:


Calcule el área del polígono con forma de estrella resultante.
Along a circle of radius R, we lay out N points such that every pair of neighboring points has the same distance. Then, we draw line segments connecting each pair of points that are separated by exactly one other point. Notice that each segment will be crossed by two other segments and, therefore, is divided into three sub-segments. For example, here is a drawing for N = 6:


If we then erase the circle and the internal sub-segments that lie between two crossings, we obtain a star-shaped polygon with N tips (spikes). For N = 6, the picture looks as follows:


Compute the area of the resulting star-shaped polygon.

Input specification

Input consists of multiple test cases (up to a maximum of 101). Each test case consists of a single line with two integers R (1 R 100) and N (5 N 1010). The last line will be "0 0" and should not be processed.

La entrada consiste de varios casos de prueba (hasta un máximo de 101). Cada caso consiste de una línea con dos enteros R (1 R 100) y N (5 N 1010). La última línea será "0 0" y no debe ser procesada.

Input consists of multiple test cases (up to a maximum of 101). Each test case consists of a single line with two integers R (1 R 100) and N (5 N 1010). The last line will be "0 0" and should not be processed.

Output specification

For each test case, print one line with the area of the star. For the computation of the area, PI is approximately equal to 3.1415927Any answer is considered correct if it has an absolute or relative error of at most 10-3 from the official answer.  
;jsessionid=4C8EA960A92F6F8D2F3DEC7B50CCEC61
Para cada caso, imprima una línea con el área del polígono en forma de estrella. Para el cálculo del área, PI es aproximadamente igual a 3.1415927Cualquier respuesta es considerada correcta si tiene una diferencia absoluta o relativa de no mas de 10-3  en comparación con la respuesta oficial.
;jsessionid=4C8EA960A92F6F8D2F3DEC7B50CCEC61

Input consists of multiple test cases (up to a maximum of 101). Each test case consists of a single line with two integers R (1 R 100) and N (5 N 1010). The last line will be "0 0" and should not be processed.

Sample input

2 6
10 7
0 0

Sample output

6.9282032
210.1798046

Hint(s)


;jsessionid=4C8EA960A92F6F8D2F3DEC7B50CCEC61


;jsessionid=4C8EA960A92F6F8D2F3DEC7B50CCEC61