当前位置:网站首页>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
边栏推荐
- guava多线程,futurecallback线程调用不平均
- [concept of network principle]
- Klocwork code static analysis tool
- gridView自己定义做时间排版「建议收藏」
- 刚开户的能买什么股票呢?炒股账户安全吗
- Implement secondary index with Gaussian redis
- 凌云出海记 | 赛盒&华为云:共助跨境电商行业可持续发展
- 微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
- Static analysis of software defects codesonar 5.2 release
- Differences and connections between MinGW, mingw-w64, tdm-gcc and other tool chains "suggestions collection"
猜你喜欢

Implement secondary index with Gaussian redis
Lex & yacc of Pisa proxy SQL parsing

Small guide for rapid formation of manipulator (12): inverse kinematics analysis

How does codesonar help UAVs find software defects?

【OpenCV 例程200篇】223. 特征提取之多边形拟合(cv.approxPolyDP)
Klocwork 代码静态分析工具

Nebula importer data import practice

Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
![嵌入式系统真正安全了吗?[ OneSpin如何为开发团队全面解决IC完整性问题 ]](/img/af/61b384b1b6ba46aa1a6011f8a30085.png)
嵌入式系统真正安全了吗?[ OneSpin如何为开发团队全面解决IC完整性问题 ]

Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
随机推荐
[uvalive 6663 count the regions] (DFS + discretization) [easy to understand]
Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
如何挑选基金产品?2022年7月份适合买什么基金?
MinGW MinGW-w64 TDM-GCC等工具链之间的差别与联系「建议收藏」
特征生成
恶魔奶爸 指南帖——简易版
Measure the height of the building
程序猿赚的那点钱算个P啊!
POJ 3140 contents division "suggestions collection"
uva 12230 – Crossing Rivers(概率)「建议收藏」
恶魔奶爸 B3 少量泛读,完成两万词汇量+
Dachang classic pointer written test questions
CodeSonar通过创新型静态分析增强软件可靠性
Static analysis of software defects codesonar 5.2 release
Jetty:配置连接器[通俗易懂]
Écrivez une liste de sauts
Klocwork 代码静态分析工具
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
软件缺陷静态分析 CodeSonar 5.2 新版发布
现在网上开户安全么?想知道我现在在南宁,到哪里开户比较好?