How many routers do you want to buy? Water problem.

Source: Internet
Author: User
Tags dashed line

The topic describes our Lele classmate for the network can be regarded as a special love, he has a plan, that is to use wireless network coverage throughout the 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 in Figure 1 is a rectangular road, and the middle dashed line represents the midline. Figure 2 is the smallest overlay. Input input includes multiple sets of test data the first part: an Integer t (1<=t<= -the second part: a total of T-lines, each line comprising three integers l,d,r represents the length of the road, and the width of the cover radius (m). (1<=l<=100000),(1<=d<= -),(1<=r<= $). The output has a single row for each set of test data output, with only one integer representing the fewest number of routers. If you cannot overwrite, output the Impossible sample input2 + 6 5 + Ten 5Sample Output5Impossible

It's a water problem.

My Code is attached below

#include <stdio.h>#include<math.h>intMain () {DoubleS,t,i,j,m,n,l,d,r; scanf ("%LF",&t);  while(t--) {scanf ("%LF%LF%LF",&l,&d,&R); S=pow (R,2)-pow (d/2,2); if(s<=0) printf ("impossible\n"); Else{s=2*sqrt (s); N=l/s; if(nint(n) = =0) printf ("%.0lf\n", N); Elseprintf ("%.0lf\n", n+1); }    }}

The feeling is very simple a triangle solves the need to pay attention to is usually more than double but the array can only be shaped can not be floating point.

How many routers do you want to buy? Water problem.

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.