Untitled

mail@pastecode.io avatar
unknown
python
a year ago
452 B
1
Indexable
Never
import os
from timeit import default_timer as Timer

import sys

sys.set_int_max_str_digits(999999999)


def fibonacci(n):
    startTime = Timer()
    a = 0
    b = 1
    temp = 0

    for i in range(2,n+1):
        temp = a + b
        a = b
        b = temp

    endTime = Timer()
    return b, endTime-startTime

result, time = fibonacci(int(sys.argv[1]))

print(f"Result : {result}")
print(f"Execution Time : {time:.10f}s")