Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
100题纪念+思路设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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator