2863. 重力加速度

灬狗蛋灬

include

include

define g 9.8

main()
{
double n,s,t,x;
while(scanf(“%lf”,&n)!=0)
{

    if(n>=1&&n<=3)
    {
        s=5*(n-1)+1.75;
    }
    if(n>3&&n<=17)
    {
        s=11.75+(n-3)*3;
    }
    t=sqrt(2*s/g);
    x=(t*1000+0.5)/1000;
    printf("%.3lf",x);
}

}

tle了咋改。。。。。。

327#0076

n = int(raw_input())
g = 9.8
if 1 <= n <= 3:
s = 5 * (n-1) + 1.75
elif n <= 17:
s = 10 + (n - 3) * 3 + 1.75
m = 2 * s / g
t = round(m ** 0.5, 3)
print(t)

你当前正在回复 博客/题目
存在问题!