You are viewing a single comment's thread. Return to all comments →
import os def get_fibs(): maxi = 10 ** 10 first, last = 1, 1 fibs = [first, last] while last <= maxi: last_new = first + last fibs.append(last_new) first = last last = last_new return fibs def isFibo(fibs, n): Y, N = "IsFibo", "IsNotFibo" if n in fibs: return Y else: return N if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') t = int(input().strip()) fibs = get_fibs() for t_itr in range(t): n = int(input().strip()) result = isFibo(fibs, n) fptr.write(result + '\n') fptr.close()
Seems like cookies are disabled on this browser, please enable them to open this website
Is Fibo
You are viewing a single comment's thread. Return to all comments →