当前位置:网站首页>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
边栏推荐
- Static analysis of software defects codesonar 5.2 release
- Codeforces Round #275 (Div. 2) C – Diverse Permutation (构造)[通俗易懂]
- 部署、收回和删除解决方式—-STSADM和PowerShell「建议收藏」
- Flask1.1.4 werkzeug1.0.1 source code analysis: Routing
- 智能软件分析平台Embold
- 如何挑选基金产品?2022年7月份适合买什么基金?
- Micro service remote debug, nocalhost + rainbow micro service development second bullet
- 华泰证券可以做到万一佣金吗,万一开户安全嘛
- Codeforces round 296 (Div. 2) A. playing with paper[easy to understand]
- Helix QAC 2020.2新版静态测试工具,最大限度扩展了标准合规性的覆盖范围
猜你喜欢
Airiot helps the urban pipe gallery project, and smart IOT guards the lifeline of the city
上海交大最新《标签高效深度分割》研究进展综述,全面阐述无监督、粗监督、不完全监督和噪声监督的深度分割方法
最新版本的CodeSonar改进了功能安全性,支持MISRA,C ++解析和可视化
解决使用uni-app MediaError MediaError ErrorCode -5
The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization
How to meet the dual needs of security and confidentiality of medical devices?
How to meet the dual needs of security and confidentiality of medical devices?
C language helps you understand pointers from multiple perspectives (1. Character pointers 2. Array pointers and pointer arrays, array parameter passing and pointer parameter passing 3. Function point
AADL Inspector 故障树安全分析模块
Lex & yacc of Pisa proxy SQL parsing
随机推荐
Hoj 2245 planktonic triangle cell (Mathematics)
Implement secondary index with Gaussian redis
Is it safe to open a stock account at present? Can I open an account online directly.
凌云出海记 | 赛盒&华为云:共助跨境电商行业可持续发展
Word inversion implements "suggestions collection"
Nebula importer data import practice
Guava multithreading, futurecallback thread calls are uneven
Solve the problem that the executable file of /bin/sh container is not found
[paper reading] maps: Multi-Agent Reinforcement Learning Based Portfolio Management System
Tensorflow2.x下如何运行1.x的代码
CodeSonar如何帮助无人机查找软件缺陷?
Data sorting in string
Helix QAC 2020.2新版静态测试工具,最大限度扩展了标准合规性的覆盖范围
Introduction to referer and referer policy
Intelligent software analysis platform embold
国家正规的股票交易app有哪些?使用安不安全
How does codesonar help UAVs find software defects?
Validutil, "Rethinking the setting of semi supervised learning on graphs"
Jetty:配置连接器[通俗易懂]
C language helps you understand pointers from multiple perspectives (1. Character pointers 2. Array pointers and pointer arrays, array parameter passing and pointer parameter passing 3. Function point