lightoj1027】的更多相关文章

题目大概说你正在起点,面前有$n$个门,每个门有一个数字$x$,正数表示开这个门$x$分钟后会出去,负数表示开这个门$-x$分钟后会回到起点.选择门的概率是一样的且每次选择互不影响.问出去的时间期望是多少. $d[0]$表示从起点出发出去的期望,$d[i](1\leqslant i\leqslant n)$表示选择第i个门出去的期望: 不妨设$1\dots j$的门是正数,$j+1\dots n$的门是负数,那么: $$d[i]=x[i](1\leqslant i\leqslant j)$$ $…
//Accepted 1688 KB 0 ms //概率简单题 //假设我们在n个门前加个起点,在n个门后加个终点,起点可以到达n个门, //为正的门可以到达终点,为负的回到起点 //则假设我们从起点到终点的期望时间为e //那么e=1/n*sum(x1)+1/n*sum((x2+e)) ,x1>0 x2<0 //两边同时乘n后,化简即可 #include <cstdio> #include <cstring> #include <iostream> #in…
有一个迷宫,有n个门,走每个的概率都是相同的 每个门有一个数字,如果是正数ai,那么表示走ai天就能走出迷宫,如果是负数,那么走-ai天会回到原地,然后会忘记之前的事情,继续选择门去走 所以,如果都是负数,那么是不可能走出迷宫的 设d为走出迷宫的期望天数 那么第三个样例就是 d = 1/3*3+1/3*(6+d)+1/3*(9+d) 那么可以算出d=18/1 #include <stdio.h> #include <string.h> #include <stdlib.h&g…
You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors. If you choose the ith door, it can either take you back to the same position where you begun…
https://cn.vjudge.net/problem/LightOJ-1027 题意:有n扇门,每扇门有个时间ti,选择正数的门可以在ti后带你走出迷宫,负数的门会在ti后带你回到起点,然后重新选择,每扇门被选中的概率是一样的,求期望. 思路: 做这种期望的问题必须得列一个方程来求解,不然无限写下去的话算不出. 设走出去的期望的E,对于第三个案例就是 E = 1/3 * 3  + 1/3( 6 + E) + 1/3 (9 + E),(选择第一扇门就直接出去,第二扇门先6分钟回去,然后再花期…
题目链接:https://vjudge.net/problem/LightOJ-1027 1027 - A Dangerous Maze    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The p…
链接: https://vjudge.net/problem/LightOJ-1027#author=634579757 题意: You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors. If you choose the ith door,…
https://vjudge.net/problem/LightOJ-1027?tdsourcetag=s_pctim_aiomsg [被满为姐姐碾压 降智打击题]…