杭电ACM2529题

这里写图片描述

就这么看好像是一道初中物理题,而事实上它就是。

#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;
}   

猜你喜欢

转载自blog.csdn.net/qq_43104182/article/details/82624136