Channel: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 4035
There are n rooms connected by N-1 tunnels. In fact, a tree is formed. Starting from node 1, there are three possibilities for each node I:
1. Killed, return to node 1 (probability is Ki)
2. Find the exit and exit the maze (probability is EI)3. There are m edges connected to the vertex and a Random Edge is taken.The expected value of the number of edges to walk out of the maze.
Ideas:
Set E
Portal: http://acm.hdu.edu.cn/showproblem.php?pid=4035 problem Descriptionwhen Wake up, Lxhgww find himself in a huge maze.The maze consisted by N rooms and tunnels connecting these rooms. Each pair of rooms are connected by one and only one path. Initially, LXHGWW is in the 1. Each is a dangerous trap. When the LXHGWW step into a, he had a possibility to being killed and restart from the 1. Every also has a hidden exit. Each time LXHGWW comes to a, h
are m edges connected to the vertex and a Random Edge is taken.The expected value of the number of edges to walk out of the maze.Set E [I] to represent the expected number of edges to walk out of the maze at node I. E [1] is the request.Leaf node:E [I] = Ki * E [1] + EI * 0 + (1-ei EI) * (E [Father [I] + 1 );= Ki * E [1] + (1-0000ei) * E [Father [I] + (1-0000ei );Non-leaf node: (m is the number of edges connected to the node)E [I] = Ki * E [1] + EI * 0 + (1-ei EI) /M * (E [Father [I] + 1 + Σ (E
The game looked at the problem, but there was no train of thought. After the game after the total through the 20+, after the game to see the problem-solving report, because the blogger said too concise, and I have never seen this DP seeking mathematical expectations of the problem, so studied for a long time wood has clear. Only search for "DP for expectations" of the topic, starting from a simple start, the eldest brother Kung Fu, finally understand, so write a detailed problem solving report.
Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 4035
Probability DP on the tree.
MazeTime Limit: 2000/1000 MS (Java/others) memory limit: 65768/65768 K (Java/others) total submission (s): 1626 accepted submission (s): 608 Special JudgeProblem descriptionwhen wake up, lxhgww find himself in a huge maze.The maze consisted by N rooms and tunnels connecting these rooms. each pair of rooms is connected by one and only one path. initiall
HDU 4035 maze
Realizing the importance of state transfer and simplifying Equations
Problem resolved from http://blog.csdn.net/morgan_xww/article/details/6776947
/**DP to find the expected question.Question:There are n rooms connected by n-1 tunnels, which actually forms a tree,Starting from node 1, there are three possibilities for each node I:1. Killed, return to node 1 (probability is Ki)2. Find the exit and exit the maze (probability is EI)3. The
probability of EI escaping from the maze. If they are neither killed nor escaped. You will randomly select a walking edge and finally ask you the expected number of edges to walk out of this maze. Idea: for the expected DP. It is easy to think that status E [I] indicates that it is currently at the I point. Expected number of edges needed to escape the maze. Then, you can write the state transition equation E [I] = Ki * E [1] + 0 * EI + (1-ei-ki) * Σ (E [J] + 1) /EDS [I]. J is the point connect
This question is in three States at each position.
Return to the starting point of death: K [I]
Locate Exit End E [I]
Do not move P [I]
K [I] + E [I] + P [I] = 1;
Because we only gave n-1 links to connect all of them together, we can naturally regard this figure as a tree structure.
Based on Father's Day and leaf nodes
Derivation
For more information, see: http://blog.csdn.net/morgan_xww/article/details/6776947/
1 # include
HDU 4035 expectation DP
HDU 4035 Maze probability dp + tree dp, hdu4035
Question: Click the open link.
#include
200 dynamic planning details
Well, I haven't learned this for a long time. I am also confused. I guess I just got started two months ago ......You can see that what he wrote is ineffective and what the optimal sub-structure is. I am also too large ............Dynamic Planning generally solves two types of problems: optimization, maximum value and minimum valu
The main topic: in a tree-shaped maze, the room as a node. There are n rooms, each room has the probability of a trap for KI, there is an exit probability of EI, if both cases are not present (the probability of pi), then can only make a choice to move to the next room (including may go to the previous room). The root node is 1, and when a trap is encountered, it must return to the root node 1 and start again, and when it encounters an exit, go out of the maze. Ask for the desired number of choi
http://acm.hdu.edu.cn/showproblem.php?pid=4035Get:1, the first inference is not a tree. In fact, all the feeling figure, both the look at the number of sides = = count-1 is not set2, sometimes, I tell the child to distinguish the tree is still necessary, that is, only when the DFS, when the number of references to a parent node to indicate the number of parameters3, must pay attention to the probability of DP to the accuracy of the very high need to start writing 1e-8,wa several, changed 1e-10 A
non-leaf node is just more $\sum_{j is I child} e[j]$2, because the expectation is originally to seek the limit significance, if the naked such request is obviously recursive infinite, we need to pass the mathematical skill to lose the formulaFor example we can for convenience, set $e[i]$ general formula for $e[i]=a[i]e[1]+b[i]e[Father]+c[i]$ (why take a father unknown?) That's because $i$ 's son needs to know the expectations of his father (ie, $i$), so we can solve the $e[i]$ by bringing them
Create an ISO image in Linux, use an ISO image, and uninstall the ISO image-Linux general technology-Linux technology and application information. For more information, see the following. In LINUX, create an ISO image file for a directory: # mkisofs-o image file name. The image directory to be created by
Reprinted from: http://bbs.duowan.com/thread-18995573-1-1.html
Original tutorial, multi-Play @ July 15, April. You are welcome to repost the course. Please indicate the source for reprinting.
Required tools for running psp iso games: ISO tool 1.970 Features Graphic tutorials
Whether it's buying new players of PSP at a price reduction trend, or old birds who have been lingering
After installing the XenServer, we need to install our virtual machine on it, which requires an ISO image file, and under Xencenter, it is not possible to mount the ISO file in our computer directly like the VMware VSphere client, but we need to use our shared folder. Of course. Creating this type of SR is useful for creating shared ISO libraries (for example, VM
ArticleDirectory
More about loop device
An ISO image is an archive file (disk image) of an Optical DiscUsing a conventional ISO (International OrganizationStandardization) format. ISO image files typically have a fileExtension of. ISO. The name "ISO" is taken
2.6.5. ANSI character encoding and Windows 1252In order to support English and Western European characters, Windows designed a code that corresponds to the code page number 1252, which is called Windows 1252.The design of Windows 1252 is a reference to the ANSI draft (ANSI Draft).The ANSI draft later developed into a formal international standard: ISO 8859-1That is, Windows 1252 was designed before it became the official standard
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.