uva12230Crossing Rivers】的更多相关文章

Uva12230Crossing Rivers 问题: You live in a village but work in another village. You decided to follow the straight path between your house (A) and the working place (B), but there are several rivers you need to cross. Assume B is to the right of A, an…
问题: You live in a village but work in another village. You decided to follow the straight path between your house (A) and the working place (B), but there are several rivers you need to cross. Assume B is to the right of A, and all the rivers lie bet…
数学期望. 过每条河的时间的可能在[L/v,3*L/v]间均匀分布,数学期望为2*L/v. 然后在加上在陆上走的时间. #include<cstdio> #include<algorithm> #include<cstring> using namespace std; int n,d,p,L,v,kase; double res; int main() { && d) { res=; ;i<=n;i++) { scanf("%d%d%d…
数学期望 P=Σ每一种状态*对应的概率. 因为不可能枚举完所有的状态,有时也不可能枚举完,比如抛硬币,有可能一直是正面,etc.在没有接触数学期望时看到数学期望的题可能会觉得很阔怕(因为我高中就是这么认为的,对不起何老板了QwQ),避之不及. 但是现在发现大多数题就是手动找公式或者DP推出即可,只要处理好边界,然后写好方程,代码超级简短.与常规的求解不同,数学期望经常逆向推出. 比如常规的dp[x]可能表示到了x这一状态有多少,最后答案是dp[n].而数学期望的dp[x]一般表示到了x这一状态还…
Problem Description   You live in a village but work in another village. You decided to follow the straight path between your house (A) and the working place (B), but there are several rivers you need to cross. Assume B is to the right of A, and all…
Description You live in a village but work in another village. You decided to follow the straight path between your house (A) and the working place (B), but there are several rivers you need to cross. Assume B is to the right of A, and all the 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 =…
Crossing Rivers                                                                                      Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description You live in a village but work in another vil…
You live in a village but work in another village. You decided to follow the straight path between yourhouse (A) and the working place (B), but there are several rivers you need to cross. Assume B is tothe right of A, and all the rivers lie between t…
说句实话,写完这道题,很想吐一口血出来,以示我心情的糟糕: 题目很简单,树形dp,正常做30分钟,硬是做了好几个小时,真是伤心. 题解不写了,只是吐个槽,网上没有用背包写的dp,全是左儿子右兄弟写法,没法对照一下,难受啊. 代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; #define LL long long int n,K; ; const LL inf=3…