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

100题纪念+思路

Posted by xuhaoran510 at 2010-08-06 11:47:28 on Problem 1953
设f[i]表示长度为i的以0结尾的合法队列个数
设g[i]表示长度为i的以1结尾的合法队列个数
显然有
f[i]=f[i-1]+g[i-1];  (1)
g[i]=f[i-1];         (2)
(2)代入(1)即
f[i]=f[i-1]+f[i-2];
最终合法队列总个数为f[n]+g[n]即f[n]+f[n-1]=f[n+1]
即求斐波那契数列的第n+1项
1,2,3,5,8,13,21.............


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