就这么看好像是一道初中物理题,而事实上它就是。
#include<stdio.h>
int main()
{
double h,l,v,x;
double g=9.8;
while(scanf("%lf %lf %lf",&h,&l,&v)!=EOF)
{
if(h==0&&l==0&&v==0)
{
break;
}
else
{
x=0.5*v*v/g-0.5*g*l*l/(v*v)+h;
printf("%.2lf\n",x);
}
}
return 0;
}