Wireless Network Coverage
Time Limit: 3000 MS | memory limit: 65535 KB
Difficulty: 3
Description
Our Lele students have a special liking for the internet. He has a plan to use wireless networks to cover Zhengzhou University.
Now the school gives him a chance, so he wants to buy many wireless routes. Now he is deploying a network on a certain Avenue, and the school only allows his wireless router to be placed in the middle of the road. By default, this avenue is straight and Its width is the same anywhere. All routers have the same coverage area. Now Lele calculates the length and width of this avenue and the coverage radius of the router. Please help him calculate the minimum number of routers he wants to purchase.
Note: To prevent interference, the minimum distance between two wireless routes cannot be less than 1 meter.
The path in Figure 1 is a rectangle, and the dotted line in the middle represents the midline. Figure 2 shows the minimum coverage.
Input
Input includes multiple groups of test data
Part 1: an integer T (1 <= T <= 500)
Part 2: A total of T rows. Each line contains three integers, L, D, and R, representing the length, width, and coverage radius (meters) of the path ).
(1 <= L <= 100000), (1 <= d <= 50), (1 <= r <= 200 ).
Output
For each group of test data output each occupies one row, there is only one integer, indicating the minimum number of routers. If it cannot be overwritten, output impossible
Sample Input
240 6 540 10 5
Sample output
5 impossible
Question: determine the number of wireless routers: Step 1. Obtain the length of the road covered by a router. Step 2. Divide the total length of the road by the length of the road covered by each router, that is, the number of routers (considering the calculation accuracy)
Program code:
# Include <stdio. h>
# Include <math. h>
# Include <stdlib. h>
Int main ()
{
Int T, L, D, R;
Double N;
Scanf ("% d", & T );
While (t --)
{
Scanf ("% d", & L, & D, & R );
N = L/(SQRT (R * R-D * D/4.0) * 2 );
If (2 * r <= D)
Printf ("impossible \ n ");
Else
{
If (N-(INT) n = 0)
Printf ("% d \ n", (INT) N );
Else
Printf ("% d \ n", (INT) n + 1 );
}
}
System ("pause ");
Return 0;
}