time limit: theMS | Memory Limit:65535KBDifficulty:3
-
-
Describe
-
Existing a lawn, a length of 20 meters, a width of 2 meters, to place a radius of Ri on the Central line of the water spray device, each sprinkler effect will let its center radius for the real Ri (0<ri<15) of the circle is moist, there is sufficient water spray device I (1<i<600) , and must be able to wet all the lawn, what you have to do is: choose as little as possible water spray device, the whole lawn moist.
-
-
Input
-
The
-
first line m indicates that there is a m group of test data
The first line of each set of test data has an integer number N,n represents a total of n water jets, followed by a row of n real Ri,ri that indicate the radius of the circle that the water spray device can cover.
-
-
Output
-
-
number of devices used in the 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
-
-
-
-
-
-
#include <stdio.h> #include <algorithm> #include <math.h>using namespace Std;int main () {int i,j,k,a,b ; scanf ("%d", &a), while (a--) {double x[1000];scanf ("%d", &b), for (i=0;i<b;i++) scanf ("%lf", &x[i]); sort (x,x+b); k=0;double c=20.0;for (i=b-1;i>=0;i--) {c-=sqrt (x[i]*x[i]-1) *2;k++;if (c<=0) break;} printf ("%d\n", k);} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Water spraying device (i.)