無線網路覆蓋 鄭州大學第三屆acm比賽試題 n 199
阿新 • • 發佈:2019-01-28
題不難,分好各種情況後再寫,一個分類討論的問題沒帶優盤,儲存一下
#include<stdio.h>
#include<math.h>
int main()
{
int T, length, wide, radius, dia;
scanf("%d", &T);
while(T--)
{
scanf("%d%d%d", &length, &wide, &radius);
dia = 2 * radius;
if(dia <= wide)
printf("impossible\n");
else
{
double len=sqrt((dia*dia - wide*wide));
if((len - length) > 0.0)
printf("1\n");
else
{
if(len-1.0 < 0.00001)
printf("impossible\n");
else
{
int num;
double fnum;
fnum = (double)length/len;
num = ceil(fnum);
printf("%d\n", num);
}
}
}
}
return 0;
}