当前位置:网站首页>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
边栏推荐
- OneSpin 360 DV新版发布,刷新FPGA形式化验证功能体验
- Codesonar enhances software reliability through innovative static analysis
- sqlHelper的增删改查
- 私募基金在中國合法嗎?安全嗎?
- 死锁的产生条件和预防处理[通俗易懂]
- MySQL约束之默认约束default与零填充约束zerofill
- What are the official stock trading apps in the country? Is it safe to use
- 反诈困境,国有大行如何破局?
- POJ 3140 contents division "suggestions collection"
- 201215-03-19—cocos2dx内存管理–具体解释「建议收藏」
猜你喜欢

目标:不排斥 yaml 语法。争取快速上手

Mongodb learn from simple to deep

OneSpin 360 DV新版发布,刷新FPGA形式化验证功能体验
![Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]](/img/af/61b384b1b6ba46aa1a6011f8a30085.png)
Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]

ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your

如何满足医疗设备对安全性和保密性的双重需求?

使用枚举实现英文转盲文

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

解决使用uni-app MediaError MediaError ErrorCode -5

Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
随机推荐
写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
Codeforces 474 F. Ant colony
MinGW MinGW-w64 TDM-GCC等工具链之间的差别与联系「建议收藏」
Mongodb learn from simple to deep
Differences and connections between MinGW, mingw-w64, tdm-gcc and other tool chains "suggestions collection"
恶魔奶爸 A3阶段 近常速语流初接触
DataTable数据转换为实体
Ubuntu安装mysql8遇到的问题以及详细安装过程
现在网上开户安全么?想知道我现在在南宁,到哪里开户比较好?
Codeforces round 275 (Div. 2) C – diverse permutation (construction) [easy to understand]
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
死锁的产生条件和预防处理[通俗易懂]
Écrivez une liste de sauts
解决使用uni-app MediaError MediaError ErrorCode -5
Mahout-Pearson correlation的实现
开户必须往账户里面赚钱吗,资金安全吗?
awk处理JSON处理
Object-C programming tips timer "suggestions collection"
上海交大最新《标签高效深度分割》研究进展综述,全面阐述无监督、粗监督、不完全监督和噪声监督的深度分割方法
Unity3d 4.3.4f1 execution project