题解 | #Fibonacci数列#
Fibonacci数列
https://www.nowcoder.com/practice/18ecd0ecf5ef4fe9ba3f17f8d00d2d66
n = int(input()) a,b = 0,1 res = 999999 while True: a,b = b,a+b res = min(res,abs(b - n)) if b > n: break print(res)
Fibonacci数列
https://www.nowcoder.com/practice/18ecd0ecf5ef4fe9ba3f17f8d00d2d66
n = int(input()) a,b = 0,1 res = 999999 while True: a,b = b,a+b res = min(res,abs(b - n)) if b > n: break print(res)
相关推荐