0 Judge
Code: 0
註:此題為 special judge,目前 Sky OJ 尚未支援此功能,想測這題的可以先去找 Chuck。
Your friend, Donald, has a villa surrounded by two tiers of fences, and he wants to calculate the area of land between them. He can measure the length of any fence, but Donald has no idea on calculating the area. Watson, one of Donald's friends, notices that the fences are probably built by a computer scientist mastering the knowledge of computational geometry, because the following facts are no coincidence.
Suddenly, you know how to calculate the area of land between the two tiers of fences from the total length $c$ of outer tier and the lengths $\ell_1,\dots,\ell_n$ of the $n$ edges of $P$. Note that Donald can measure these length. Could you help him to calculate the area?
The first line of the input contains a positive integer $T$ indicating the number of test cases. Each test case consists of two lines. The first line contains two numbers $c$ and $n$ separated by a space. $c$ is the total length of the outer tier, i.e., $c$ is the perimeter of $C$. $n$ is the number of vertices of P. The second line contains $n$ positive integers $\ell_1,\dots,\ell_n$ indicating the lengths of edges of $P$.
You may assume:
For each case, output the area between the two tiers of fences. Your answer will be accepted if the absolute error or the relative error is less than $10^{-6}$.
2
10.0 3
1 1 1
10.0 4
1 1 1 1
7.524734452702549
6.9577471545947684
你的朋友東納德的別墅外有兩層圍籬,他想要計算在這兩層圍籬之間的土地面積。他能測量圍籬的長度,但他對計算面積毫無概念。東納德的朋友華生發現圍籬可能是由專精於計算幾何的電腦科學家建造的,因為下列事實絕非巧合:
你恍然大悟。你明白了如何由外層圍籬總長$c$以及內層圍籬的$n$個邊長$\ell_1,\dots,\ell_n$ 計算出兩個圍籬之間的土地面積。還記得東納德知道如何測量圍籬長度吧?請幫他算出面積吧。
輸入的第一行有一個正整數$T$代表有多少筆測試資料。每一筆測試資料有兩行,第一行有兩個數字$c$ 跟 $n$,以一個空白隔開。$c$代表了外層圍籬的總長,也就是$C$的周長。$n$代表內層圍籬的頂點數目。第二行有$n$個正整數$\ell_1,\dots,\ell_n$,代表$n$邊形$P$的各個邊長。
可假設:
對每筆測試資料,請輸出兩層圍籬間的土地面積。只要絕對或相對誤差小於$10^{-6}$就會被視為正確。