ZZU_2 简单的无线网络覆盖

 1 #include<stdio.h>
2 #include<stdlib.h>
3 #include<math.h>
4
5 int main()
6 {
7 int i, ncases;
       double l, d, r,n, num, k;
9
10 while(scanf("%d",&ncases) != EOF)
11 {
12 for(i=0; i<ncases; i++)
13 {
14 scanf("%d%d%d",&l, &d, &r);
15 if(r <= d/2)
16 printf("impossible\n");
17 else
18 {
19 s = sqrt(r*r-(d/2)*(d/2));
21 num = l/(s*2);
               k = floor(num);
22 if(k < num)
23 printf("%d\n", (int)k + 1);
24 else
25 printf("%d\n", (int)k);
26 }
27 }
28 }
29 return 0;
30 }

 

posted @ 2011-12-08 09:07  zhongya  阅读(158)  评论(0编辑  收藏  举报