Wireless network coverage

Source: Internet
Author: User
Tags dashed line

Describe

Our Lele classmate for the network can be regarded as a special love, he has a plan, that is to use wireless network coverage of Zhengzhou University.

Now the school gives him a chance, so he wants to buy a lot of wireless routing. Now he is deploying a network of roads, and the school is only allowed to put his wireless router in the middle of the road. We are by default the road is straight and its width is the same everywhere. And the coverage area of all routers is the same. Now Lele calculates the length and width of the boulevard, and the radius of the router's coverage, and wants to ask you to help him figure out the number of routers he has to buy at least.

Note: In order to prevent some interference, the minimum distance between two non-lines cannot be less than 1 meters.

Figure 1 is a rectangular road with a dashed line in the middle that represents the midline. Figure 2 is the smallest overlay.

 
Input
input includes multiple sets of test data
First part: An integer T (1<=t<=500)
Part Two: A total of T-lines, each line consisting of three integers l,d,r represents the length of the road, width and coverage radius (m).
( 1<=l<=100000), (1<=d<=50), (1<=r<=200).
Output
for each set of test data outputs, there is only one integer representing the minimum number of routers. If it cannot be overwritten, output impossible
Sample input
240 6 540) 10 5
Sample output
5impossible

1 ImportJava.text.NumberFormat;2 Importjava.util.Arrays;3 ImportJava.util.Scanner;4 5  Public classMain {6      Public Static voidMain (string[] args) {7Scanner scanner=NewScanner (system.in);8         intT;9         intL;Ten         intD; One         intR; A         Doubledistance; -          -t=scanner.nextint (); the          while(true){ -             if(t==0) -                  Break; -t--; +              -L=scanner.nextint (); +D=scanner.nextint (); AR=scanner.nextint (); at              -             if(2*r*2*r<=d*D) { -System.out.println ("Impossible"); -                 Continue; -             } -              in             /*if (r*r<= (d/2.0) * (d/2.0)) { - System.out.println ("impossible"); to continue; +             }*/ -              thedistance=r*r-(d/2.0) * (d/2.0); *Distance=math.sqrt (distance); $             Panax Notoginseng             if(2*distance<1){ -System.out.println ("Impossible"); the                 Continue; +             } A              thedistance=2*r*2*r-d*D; +Distance=math.sqrt (distance); -distance=l/distance; $Distance=Math.ceil (distance); $              -System.out.printf ("%.0f\n", distance); -                  the         } -             Wuyi     }  the}

Wireless network coverage

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.