UVA 12230 - Crossing Rivers(概率)
UVA 12230 - Crossing Rivers
题意:给定几条河,每条河上有来回开的船,某一天出门,船位置随机,如今要求从A到B,所须要的期望时间
思路:每条河的期望,最坏就是船刚开走3L/V,最好就是直接上船L/V,期望为4L/V/2 = 2L/V,然后在算上陆地上的时间,就是答案
代码:
#include <stdio.h>
#include <string.h> int n;
double d, p, l, v; int main() {
int cas = 0;
while (~scanf("%d%lf", &n, &d) && n || d) {
while (n--) {
scanf("%lf%lf%lf", &p, &l, &v);
d = d - l + l * 2 / v;
}
printf("Case %d: %.3lf\n\n", ++cas, d);
}
return 0;
}
UVA 12230 - Crossing Rivers(概率)的更多相关文章
- UVA - 12230 Crossing Rivers 概率期望
You live in a village but work in another village. You decided to follow the straight path between y ...
- UVA - 12230 Crossing Rivers (期望)
Description You live in a village but work in another village. You decided to follow the straight pa ...
- UVa 12230 - Crossing Rivers(数学期望)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVA 12230 Crossing Rivers
嘟嘟嘟 虽然分类是期望dp,不过好像是最水的 因为在陆地上的时间和概率是固定的,所以只用考虑过河的期望时间. 对于一条河p, l, v,p好像没什么用……不管了,首先期望时间我觉得可以这么算:期望时间 ...
- UVA.12230.Crossing Rivers(期望)
题目链接 /* 到达一条河时,船在河中的位置是随机的,所以船到达岸边需要的时间在 0~2l/v 均匀分布,所以船到岸的期望为 (0+2l/v)/2 过河需要 l/v 的时间,所以过一条河总的期望为 ( ...
- Uva - 12230 Crossing Rivers (数学期望)
你住在村庄A,每天需要过很多条河到另一个村庄B上班,B在A的右边,所有的河都在A,B之间,幸运的是每条船上都有自由移动的自动船, 因此只要到达河左岸然后等船过来,在右岸下船,上船之后船的速度不变.现在 ...
- UVA - 12230 Crossing Rivers(过河)(期望)
题意:从A到B需要经过n条河,已知AB间距离D和每条河的长度L以及在该条河上的船速v,求A到B平均情况下需多长时间.陆地行走速度为1,船的位置和朝向均匀随机. 分析: 1.过一条河,最短时间L/v(无 ...
- HDU3232 Crossing Rivers 数学期望问题
Crossing Rivers ...
- HDU 3232 && UVA 12230 (简单期望)
Crossing Rivers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
随机推荐
- Java多线程yield
前言: 前几天复习了一下多线程,发现有许多网上讲的都很抽象,所以,自己把网上的一些案例总结了一下! 一. Thread.yield( )方法: 使当前线程从执行状态(运行状态)变为可执行态(就绪状态) ...
- ThinPHP第二十七天(kindEditor使用,$.each)
1.KindEditor简单使用实例 <js file="__PUBLIC__/kindeditor/kindeditor.js" /> <js file=&qu ...
- codeforces 650B . Image Preview 二分
题目链接 B. Image Preview time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Oracle ODI系列之一(ODI知识模块)
Oracle ODI系列之一(ODI知识模块) ODI简介 ODI(Oracle Data Integrator)前身是Sunopsis Active Integration Platform ...
- AAU账号分割
import win.ui; import fsys.dlg; import string.list; /*DSG{{*/ var winform = win.form(text="aard ...
- 在PADS LAYOUT中如何隐藏不需要的鼠线?
如下图示,将net GPR_0的鼠线隐藏. 鼠标右键,选择网络----选择你要隐藏的网络------右键选择view nets----点击对话框右边View List里你所选的网络-----在右下角t ...
- Maven 添加Jetty
<build> <finalName>springmvc</finalName> <plugins> ...
- C++STL之string (转)
在学习c++STL中的string,在这里做个笔记,以供自己以后翻阅和初学者参考. 1:string对象的定义和初始化以及读写 string s1; 默认构造函数,s1为空串 string ...
- ios蓝牙开发(一)蓝牙相关基础知识
蓝牙常见名称和缩写 MFI ======= make for ipad ,iphone, itouch 专们为苹果设备制作的设备 BLE ==== buletouch low energy,蓝牙4.0 ...
- linux多线程示例
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h& ...