UVa 10693

題目:車速為v,車之間的距離最少為v^2/(2f)(防止裝車),車長為L,問1小時最多能走過幾輛車。

分析:數學、物理。

            根據題意能够列出方程:nL + (n-1)d = nL + (n-1)v^2/(2f) = 3600v,計算n。化簡得;

            n = 7200f/(2Lf/v + v)。這是一個對號函數。當2Lf = v^2 是有最大值。

            因此v = sqrt(2Lf),n = 1800sqrt(2f/L)。

說明:╮(╯▽╰)╭。

#include <cstdio>
#include <cmath>

int main()
{
	int L,f;
	while (~scanf("%d%d",&L,&f) && f) 
		printf("%.8lf %.8lf
",sqrt(2.0*L*f), 1800.0*sqrt(2.0*f/L));
	
    return 0;
}




【推广】 免费学中医,健康全家人
原文地址:https://www.cnblogs.com/llguanli/p/8468817.html