For a given value of n and m, find fib(n) mod m where n is very huge. (Pisano Period)
问题 Input Integers 'n' (up to 10^14) and 'm'(up to 10^3) Output Fib(n) modulo m Sample Cases Input: 239 1000 Output: 161 Input: 2816213588 239 Output: 151 Hint given in Question As it is not possible to iterate 'n' times (because n is huge), consider using Pisano Period(repetition of remainders when every element Fibonacci series is divided by any integer) Code which I wrote (maybe wrong, but passes above-mentioned cases) n, m = map(int, input().split()) a, b = 0, 1 fib_rems = [0, 1] # remainders