hdu-5753 Permutation Bo(概率期望)】的更多相关文章

Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequences h1∼hn and c1∼cn. h1∼hn is a permutation of 1∼n. particularly, h0=hn+1=0. We define the expression [condition] is 1 when condition is True,is 0 whe…
Permutation Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequences h1∼hn and c1∼cn. h1∼hn is a permutation of 1∼n. particularly, h0=hn+1=0. We define the expression [condition] is 1 when condition is True,is 0 whe…
题目链接: Permutation Bo Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 131072/131072 K (Java/Others) Problem Description There are two sequences h1∼hn and c1∼cn. h1∼hn is a permutation of 1∼n. particularly, h0=hn+1=0. We define the expression …
这里是一个比较简单的问题:考虑每个数对和的贡献.先考虑数列两端的值,两端的摆放的值总计有2种,比如左端:0,大,小:0,小,大:有1/2的贡献度.右端同理. 中间的书总计有6种可能.小,中,大.其中有两种对答案有贡献,即1/3的贡献度.加和计算可得到答案. Permutation Bo Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s):…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 题目大意: 两个序列h和c,h为1~n的乱序.h[0]=h[n+1]=0,[A]表示A为真则为1,假为0. 函数f(h)=(i=1~n)∑ci[hi>hi−1 && hi>hi+1] 现在给定c的值,求f(h)的期望. 题目思路: [数学] 头尾的概率为1/2,中间的概率为1/3,直接求和. // //by coolxxx // #include<iostream&g…
题意 总共有 $n$ 层楼,在第 $i$ 层花费 $a_i$ 的代价,有 $pi$ 的概率到 $i+1$ 层,否则到 $x_i$($x_i \leq 1$) 层.接下来有 $q$ 次询问,每次询问 $l$ 层到 $j$ 层的期望代价. 分析 这种期望具有可加性,因此,维护一个前缀和 $sum[i]$:从 $1$ 到 $i$ 的期望. 设从 $i$ 到 $i+1$ 的期望代价为 $E$,则有 $E = a_i + (1-\frac{r_i}{s_i})(sum[i]-sum[x_i]+E)$ 解得…
Problem Description Everyone knows Matt enjoys playing games very much. Now, he to N. Input The first line of the input contains an integer T, denoting the number of testcases. Then T test cases follow. In the first line of each test ) indicating the…
Robot Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 779    Accepted Submission(s): 304 Problem Description Michael has a telecontrol robot. One day he put the robot on a loop with n cells. T…
Permutation Bo Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 574    Accepted Submission(s): 346Special Judge Problem Description . We define the expression [condition] is 1 when condition is…
1419: Red is good Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 660  Solved: 257[Submit][Status][Discuss] Description 桌面上有R张红牌和B张黑牌,随机打乱顺序后放在桌面上,开始一张一张地翻牌,翻到红牌得到1美元,黑牌则付出1美元.可以随时停止翻牌,在最优策略下平均能得到多少钱. Input 一行输入两个数R,B,其值在0到5000之间 Output 在最优策略下平均能得到多少钱…