当前位置:网站首页>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
边栏推荐
- 【矩阵乘】【NOI 2012】【cogs963】随机数生成器
- sqlHelper的增删改查
- 私募基金在中国合法吗?安全吗?
- 权限不足
- 【C语言】指针进阶---指针你真的学懂了吗?
- Is it safe to open a stock account at present? Can I open an account online directly.
- Write a jump table
- [uvalive 6663 count the regions] (DFS + discretization) [easy to understand]
- 部署、收回和删除解决方式—-STSADM和PowerShell「建议收藏」
- Do you have to make money in the account to open an account? Is the fund safe?
猜你喜欢
Mysql子查询关键字的使用方式(exists)
Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
Ubuntu安装mysql8遇到的问题以及详细安装过程
Dachang classic pointer written test questions
使用高斯Redis实现二级索引
恶魔奶爸 B3 少量泛读,完成两万词汇量+
Codesonar enhances software reliability through innovative static analysis
C语言 整型 和 浮点型 数据在内存中存储详解(内含原码反码补码,大小端存储等详解)
Make this crmeb single merchant wechat mall system popular, so easy to use!
如何满足医疗设备对安全性和保密性的双重需求?
随机推荐
Write a jump table
A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
How to choose financial products? Novice doesn't know anything
现在网上开户安全么?想知道我现在在南宁,到哪里开户比较好?
Referrer和Referrer-Policy简介
Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
C语言多角度帮助你深入理解指针(1. 字符指针2. 数组指针和 指针数组 、数组传参和指针传参3. 函数指针4. 函数指针数组5. 指向函数指针数组的指针6. 回调函数)
margin 等高布局
POJ 3140 contents division "suggestions collection"
Phoenix JDBC
Details of C language integer and floating-point data storage in memory (including details of original code, inverse code, complement, size end storage, etc.)
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
万字总结数据存储,三大知识点
Onespin | solve the problems of hardware Trojan horse and security trust in IC Design
Data sorting in string
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
想杀死某个端口进程,但在服务列表中却找不到,可以之间通过命令行找到这个进程并杀死该进程,减少重启电脑和找到问题根源。
Introduction to referer and referer policy
[matrix multiplication] [noi 2012] [cogs963] random number generator
私募基金在中國合法嗎?安全嗎?