From 766299cbb40caff5ffc3d349d2e8f1246abb921a Mon Sep 17 00:00:00 2001 From: yenru0 Date: Sun, 4 Aug 2024 11:06:59 +0900 Subject: [PATCH] complete 6571.py --- zeta_python/completed/6571.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 zeta_python/completed/6571.py diff --git a/zeta_python/completed/6571.py b/zeta_python/completed/6571.py new file mode 100644 index 0000000..a5a9978 --- /dev/null +++ b/zeta_python/completed/6571.py @@ -0,0 +1,28 @@ +import sys +import bisect + +input = sys.stdin.readline + +Mem = [1, 2, 3] + + +def fib_count(a: int, b: int): + if b <= Mem[-1]: + pass + else: + while b > Mem[-1]: + Mem.append(Mem[-1] + Mem[-2]) + + right = bisect.bisect_right(Mem, b) + left = bisect.bisect_left(Mem, a) + + return right - left + + +if __name__ == "__main__": + while True: + a, b = map(int, input().split()) + if a == b == 0: + break + else: + print(fib_count(a, b))