Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

一点思路

Posted by lolihunter at 2009-11-24 22:59:23 on Problem 3744
把对应的坐标,换成要走的步数F(n)表示从原点走n步的概率。
易根据题意得到F(n)=p*F(n-1)+q*F(n-2) 其中F(0)=1,q=p-1
用母函数(组合数学)求解通项F(n)
对于第一个要走n步的雷,特工要存活就必须跨过这个雷,也就是走n-1步。在跨2步。这个概率就是F(n-1)*q.再以这个点为起点,计算跨过下个雷的概率。相乘即可。
注意2个必死的情况。当有连续2颗雷,必死。当起点有雷,必死。
注意G++输出%lf和%f的问题。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator