Wednesday 30 January 2013

11932. Amz Rock Problem code: AMZRCK

p=5**.5;f=lambda n:((1+p)**n-(1-p)**n)/(2**n*p)
i=input
for j in range(i()):
 print int(f(i()+2))

3 comments:

  1. The function f=lambda n:((1+p)**n-(1-p)**n)/(2**n*p) represents the closed-form expression for the nth element in the Fibonacci series

    ReplyDelete
    Replies
    1. First of all note that "the number of ways of selecting a playlist such that no two successive tracks are selected" is forming the Fibonacci series..

      Delete