UVA 3485 Bridge】的更多相关文章

题目大意 你的任务是修建一座大桥.桥上等距地摆放着若干个塔,塔高为H,宽度忽略不计.相邻两座塔之间的距离不能超过D.塔之间的绳索形成全等的对称抛物线.桥长度为B,绳索总长为L,如下图所示求建最少的塔时绳索的最下端离地的高度y. [输入格式] 输入第一行为测试数据组数T.每组数据包含4个整数D,H,B,L(B<=L). [输出格式] 对于每组数据,输出绳索底部离地高度,保留两位小数. 间隔数为n=[(B+D-1)/D],所以间隔和每个间隔的绳子长分别为w=B/n,L=L/n 根据微积分,一个二次函…
uva 1356 Bridge ( 辛普森积分 ) 不要问我辛普森怎么来的,其实我也不知道... #include<stdio.h> #include<math.h> #include<string.h> #include<algorithm> using namespace std ; double d , h , m , b , l , w ; double f ( double x ) { double a = 4.0 * m / w / w ; re…
UVA 1356 - Bridge option=com_onlinejudge&Itemid=8&page=show_problem&category=493&problem=4102&mosmsg=Submission+received+with+ID+13932460" target="_blank" style="">题目链接 题意:一个桥长为B,桥上建电线杆.杆高为H,两杆之间距离不超过D.电线杆总长…
Bridge A suspension bridge suspends the roadway from huge main cables, which extend from one end of the bridge to the other. These cables rest on top of high towers and are secured at each end by anchorages. The towers enable the main cables to be dr…
题目大意 在一个晚上有N个人过河,他们有一个手电筒,需要有手电筒才能过河,每次最多两个人同时过河,每次过河时间等于速度最慢的那个人的过河时间,让所有人全部过河,花费的时间最少是多少? 分析 如果只有一个人过河,那么过河的总时间就是这个人过河的时间.如果是两个人过河,那么总时间为过河速度较慢的那个人的过河时间.如果是三个人过河,总花费时间为a+b+c.当人数大于等于4时,我们每次都让两个速度最慢的人过河,假设A和B表示速度最快和第二快的人,速度分别为a,b,C和D表示速度最慢和第二慢的人,速度分别…
自适应辛普森公式模板. #include<algorithm> #include<iostream> #include<cstring> #include<cstdio> #include<vector> #include<queue> #include<cmath> #include<map> #include<set> #define LL long long #define CLR(a, b)…
题意: 过河模型:有n个人要渡河,每个人渡河所耗时可能不同,只有1只船且只能2人/船,船速取决于速度慢的人.问最少耗时多少才能都渡完河? 思路: n<2的情况比较简单. 考虑n>2的情况,第一次肯定是两个耗时少的先过去.接下来有两种渡河方式,有可能是{a回,另外2人去,b回,a和b去},也可能是{a回,a和另一人去}.也就是说a和b的协作可以送走其他2个人,或者是a自己当船夫,送走另外一个人.这样子就有两种决策啦. 先将他们排个序(升序),然后a和b先过去.如果还有人没有过河,若left>…
1.LA 5694 Adding New Machine 关键词:数据结构,线段树,扫描线(FIFO) #include <algorithm> #include <cstdio> #include <cstring> #include <string> #include <queue> #include <map> #include <set> #include <ctime> #include <cm…
桥的间隔数为n = ceil(B/D),每段绳子的长度为L / n,相邻两塔之间的距离为 B / n 主要问题还是在于已知抛物线的开口宽度w 和 抛物线的高度h 求抛物线的长度 弧长积分公式为: 设抛物线方程为f(x) = ax2,则这段抛物线弧长为 查积分表或者自己分部积分算一下:  二分抛物线高度x,使得每段抛物线长度为L / n,所求答案为H - x #include <cstdio> #include <cmath> inline double F(double a, do…
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=737 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82833#problem/C 说实话还不是太懂,自己再写点题理解理解! 代码: #include<cstdio> #include<cstdlib&g…