37-Language Primer -37-wireless network coverage

Source: Internet
Author: User
Tags dashed line

Title address: http://acm.nyist.net/JudgeOnline/problem.php?pid=199?? Description
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 kind of interference, the minimum distance between two non-lines cannot be less than1m
Figure1is a rectangular road with a dashed line in the middle that represents the midline. Figure2to the minimum coverage. ?
input
input includes multiple sets of test data
First part: an integerT (1<=t<=500)
Part II: AltogetherTrows, each row consists of three integersL,d,rrepresents the length, width and coverage radius of the road (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, outputImpossible
Sample Input
2
40 6 5
40 10 5
Sample Output
5Impossible???#include <stdio.h>
#include <math.h>

//working with Data
Static void Handlerdata ();

int Main ()
{
??? int Readlen = 0;
??? scanf("%d", &readlen);
??? GetChar();
???
??? while (readlen>0)
??? {
??????? Handlerdata();
???????
??????? --readlen;
??? }
???
??? return 0;
}

//working with Data
Static void Handlerdata ()
{
??? float Rectlen = 0.0f;
??? float rectwidth = 0.0f;
??? float radius = 0.0f;
???
??? scanf("%f%f%f", &rectlen,&rectwidth,&radius);
??? GetChar();
???
??? float halfrectwidth = rectwidth*0.5f;
??? if (RADIUS < halfrectwidth)
??? {
??????? printf("impossible\n");
??????? return;
??? }
???
??? float Tmplen = sqrt(radius*radius-halfrectwidth*halfrectwidth) *2;
??? if ((tmplen-1) < 0)
??? {
??????? printf("impossible\n");
??????? return;
??? }
???
??? int Number = Ceil(Rectlen/tmplen);
???
??? printf("%d\n", number);
}
Problem solving can be changed to right triangle.??

37-Language Primer -37-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.