Hackerrank - Algorithm - Fibonacci Modified
Given terms and where , term is computed using the following relation:
For example, if term and , term , term , term , and so on.
Given three integers, , , and , compute and print term of a modified Fibonacci sequence.
-----------------------------------------------------------------------------------------
Source Code:
t1,t2,n = map(int,raw_input().split())
for i in range(1,n-1):
ans = t1 + t2**2
t1 = t2
t2= ans
print(ans)
------------------------------------------------------------------------------------------------------
#hackerrank #algorithm #fibonaccimodified #solution #sourcecode #python #submission
No comments:
Post a Comment