Sprinkler (1), sprinkler (
Sprinkler (1) Time Limit: 3000 MS  memory limit: 65535 KB difficulty: 3

Description

There is a lawn with a length of 20 meters and a width of 2 meters. A sprinkler with a radius of Ri should be placed on the horizontal center, the effect of each sprinkler will make the circle with its center radius as the real number Ri (0 <Ri <15) moist, there are plenty of sprinkler I (1 <I <600), and you will surely be able to wet all the lawns. What you need to do is: select as few sprinkler as possible, wet all the lawns.

Input

The first line m indicates that there are m groups of test data
The first line of each set of test data has an integer n, n indicates a total of n sprinkler devices, and the subsequent line has n real number ri, ri indicates the radius of the circle covered by the sprinkler.

Output

Number of devices used for output

Sample Input

252 3.2 4 4.5 6 101 2 3 1 2 1.2 3 1.1 1 2

Sample output

25
This problem simplifies many operations because the width of the matrix is 2...
You only need to calculate the oblique edge length of the lawn, and then as long as the radius of all circles is larger than half of the length of the Oblique Edge (but you must discard the device with a radius less than or equal to 1, no matter how it is placed on the horizontal line, it cannot completely cover the grass ).
X = sqrt (r * r(h/2) * (h/2) so that the circle with a radius of r can overwrite the length of 2x, with the remaining w2x, in this way, when w <= 0, it is satisfied.
R = sqrt (x * x + h * h)/2 Total r = sqrt (w * w + h * h)/2
Simply put, the sum of the radius (not equal to or less than 1) of all circles is greater than half of the length of the Oblique Edge.
#include <iostream>02.#include <algorithm>03.#include <cmath>04.#include <cstdio>05.using namespace std;06.const double PI = acos(1.0);07.int main()08.{09.int n,m;10.cin>>n;11.while(n)12.{13.double a[610];14.int m;15.cin>>m;16.for(int i = 0; i < m; i++) cin>>a[i];17.sort(a,a+m);18.double sum = 0;19.double len = sqrt(20*20 + 2*2)/2;20.int count = 0;21.for(int i = m1; i >=0 ;i)22.{23.sum += a[i];24.count++;25.if(sum > len) break;26.}27.cout<<count<<endl;28.}29.return 0;30.}