Wireless Network Coverage

Source: Internet
Author: User
Wireless Network Coverage

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 includes three integers L, D, R represents 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
5impossible

 #include <iostream>#include <cmath>using namespace std;int main(){    int n;    int a,b;    cin>>n;    while(n--)    {        int l,d,r;cin>>l>>d>>r;if(4*r*r < 1 + d*d){    cout<<"impossible"<<endl; continue;}double ll = sqrt(4.0*r*r - d*d)/2;double nn = (l/ll) / 2;if((int)(nn*1000000) == (int) nn * 1000000) cout<< (int)nn<<endl;else     cout <<(int)nn+1<<endl;}return 0;}        

 

Wireless Network Coverage

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.