Fast O(log n) computation of n-th fibonacci number.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|import numpy as np|
|n = int(input())|
|M = np.matrix([[1,1],[1,0]], dtype="object")|
|ans = (M**n)[0,0]|