L3/M1, 2005–2006

Algorithmique effective – TD 6 Encore de la géométrie, suite

1 Routine(s)

Exercice 1

1. Écrire une fonction prenant en entrée deux angles (en radians) et calculant les longueurs des côtés du triangle correspondant, en supposant que l’une d’elles est 1.

2. Écrire une fonction prenant en entrée trois longueurs (float) et calculant les angles en radians du triangle correspondant.

3. Écrire une fonction prenant en entrée trois points à coordonnées float et renvoyant un nombre flottant positif s’ils sont dans le sens trigonométrique, négatif sinon. On pourra utiliser l’aire signée.

2 Round Up^{\begin{matrix}r \\ ◯ \end{matrix}}

Exercice 2 Herding Frosh. PC : 111401 ; UVa : 10135. One day, a lawn in the center of campus became infested with frosh. In an effort to beautify the campus, one of our illustrious senior classmen decided to round them up using a length of pink silk. Your job is to compute how much silk was required to complete the task.

The senior classman tied the silk to a telephone post, and walked around the perimeter of the area containing the frosh, drawing the silk taught so as to encircle all of them. He then returned to the telephone post. The senior classman used the minimum amount of silk necessary to encircle all the frosh plus one extra meter at each end to tie it.

You may assume that the telephone post is at coordinates (0, 0), where the first dimension is north/south and the second dimension is east/west. The coordinates of the frosh are given in meters relative to the post. There are no more than 1,000 frosh.

Input

The input begins with a single positive integer on a line by itself indicating the number of test cases, followed by a blank line.

Each test case consists of a line specifying the number of frosh, followed by one line per frosh with two real numbers giving his or her position.

There is a blank line between two consecutive inputs.

Output

For each test case, the output consists of a single number : the length of silk in meters to two decimal places. The output of two consecutive cases will be separated by a blank line.

Sample Input

4
1.0 1.0
-1.0 1.0
-1.0 -1.0
1.0 -1.0

Sample Output

10.83

3 Privé de dessert

Pas de DM pour cette fois !