#include <stdio.h>
#include <math.h>
int main ()
{
int a , b , c;
int step = 0;
while (scanf("%d%d%d", &a , &b , &c) != 0)
{
if (a == 0 && b == 0 && c == 0) break;
step++;
printf ("Triangle #%d\n" , step);
if (a == -1 )
{
if (b > 0 && c > 0 && c > b)
{
printf ("a = %.3lf\n" , sqrt((c*c - b*b) * 1.0));
}
else printf("Impossible.\n");
}
else if (b == -1)
{
if (a > 0 && c > 0 && c > a)
{
printf("b = %.3lf\n" , sqrt((c*c - a*a) * 1.0));
}
else printf("Impossible.\n");
}
else
{
if (a > 0 && b > 0)
{
printf ("c = %.3lf\n" , sqrt((a*a + b*b) * 1.0));
}
else printf("Impossible.\n");
}
printf ("\n");
}
return 0;
}
ZOJ Problem Set - 1241 Geometry Made Simple
最新推荐文章于 2019-08-14 19:08:42 发布