`
阿尔萨斯
  • 浏览: 4173874 次
社区版块
存档分类
最新评论

uva 10693 - Traffic Volume(数论)

 
阅读更多

题目链接:uva 10693 - Traffic Volume


题目大意:每辆车长度l,两辆车之间距离为d,d = v*v/(2*f),现在给出l和f,求说v的最大值,以及单位时间内通过某位置的车数。


解题思路:t=(l+d)/v=l/v + v/(2*f), 如果t越小,那么v就最大;

因为a + b ≥ 2√(a*b)当且仅当a = b的时候,v =√(2*l*f),速度知道了,另外一个也就好求了。


#include <cstdio>
#include <cstring>
#include <cmath>

int main () {
	double l, f;
	while (scanf("%lf%lf", &l, &f) == 2 && l + f) {
		printf("%.8lf %.8lf\n", sqrt(2 * l * f), 3600 * sqrt(f / (2 * l)));
	}
	return 0;
}


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics