当前位置:网站首页>UVA 12230 – crossing rivers (probability) "suggested collection"
UVA 12230 – crossing rivers (probability) "suggested collection"
2022-07-07 21:05:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
Topic link :uva 12230 – Crossing Rivers
The main idea of the topic : A man goes to work in the company every day . Every time I pass N Rivers . The distance between home and company is D. The default speed on land is 1, give N Information about the river . Include starting coordinates p, Width L, And the speed of the ship .
The boat will go back and forth on both sides of the river . People reach the river bank is . The position of the ship is random ( Including direction ). Ask about the expected time for people to reach the company .
Their thinking : Time on land is fixed , Just calculate the time of each river separately . Because when people get to the shore , The position of the ship is random , So the waiting time [0,2L/v], The period is equal probability , So the time to cross a river is extremely (0+2∗Lv)2+Lv=2∗Lv
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main () {
int cas = 1;
int N;
double D, p, l, v;
while (scanf("%d%lf", &N, &D) == 2 && (N || D)) {
for (int i = 0; i < N; i++) {
scanf("%lf%lf%lf", &p, &l, &v);
D = D - l + 2 * l / v;
}
printf("Case %d: %.3lf\n\n", cas++, D);
}
return 0;
}
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/116447.html Link to the original text :https://javaforall.cn
边栏推荐
- Postgresql数据库character varying和character的区别说明
- 目前股票开户安全吗?可以直接网上开户吗。
- 使用枚举实现英文转盲文
- 刚开户的能买什么股票呢?炒股账户安全吗
- 私募基金在中国合法吗?安全吗?
- Tensorflow2. How to run under x 1 Code of X
- How to meet the dual needs of security and confidentiality of medical devices?
- 如何满足医疗设备对安全性和保密性的双重需求?
- Onespin | solve the problems of hardware Trojan horse and security trust in IC Design
- HOJ 2245 浮游三角胞(数学啊 )
猜你喜欢
【C语言】指针进阶---指针你真的学懂了吗?
程序猿赚的那点钱算个P啊!
Codesonar enhances software reliability through innovative static analysis
Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
使用高斯Redis实现二级索引
Ubuntu安装mysql8遇到的问题以及详细安装过程
SQL注入报错注入函数图文详解
使用枚举实现英文转盲文
MySQL约束之默认约束default与零填充约束zerofill
H3C s7000/s7500e/10500 series post stack BFD detection configuration method
随机推荐
Phoenix JDBC
What are the official stock trading apps in the country? Is it safe to use
Mongodb learn from simple to deep
阿洛的烦恼
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
Measure the height of the building
Cantata9.0 | new features
margin 等高布局
Guava multithreading, futurecallback thread calls are uneven
Ubuntu安装mysql8遇到的问题以及详细安装过程
[award publicity] issue 22 publicity of the award list in June 2022: Community star selection | Newcomer Award | blog synchronization | recommendation Award
【奖励公示】第22期 2022年6月奖励名单公示:社区明星评选 | 新人奖 | 博客同步 | 推荐奖
ISO 26262 - 基于需求测试以外的考虑因素
Apifox interface integrated management new artifact
恶魔奶爸 B3 少量泛读,完成两万词汇量+
Hoj 2245 planktonic triangle cell (Mathematics)
[paper reading] maps: Multi-Agent Reinforcement Learning Based Portfolio Management System
Word inversion implements "suggestions collection"
恶魔奶爸 A1 语音听力初挑战
Le capital - investissement est - il légal en Chine? C'est sûr?