http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1241
#include<stdio.h>
#include<string.h>#include<math.h>
#include<ctype.h>
int main()
{
double a,b,c;
double s;
int i=0;
while(scanf("%lf%lf%lf",&a,&b,&c),(a||b||c))
{
printf("Triangle #%d\n",++i);
if(a==-1)
{
s=pow(c,2)-pow(b,2);//不能sqrt(负数)
if(s<=0)
puts("Impossible.\n");
else
printf("a = %.3lf\n\n",sqrt(s));
}
else if(b==-1)
{
s=pow(c,2)-pow(a,2);
if(s<=0)
puts("Impossible.\n");
else
printf("b = %.3lf\n\n",sqrt(s));
}
else if(c==-1)
{
s=sqrt(pow(a,2)+pow(b,2));
printf("c = %.3lf\n\n",s);
}
}
return 0;
}