题解 | #兔子的数量#
兔子的数量
https://www.nowcoder.com/practice/8783056676de4396b0bf816a3561d62f
def rabit(n): if n == 1: return 2 elif n == 2: return 3 return rabit(n - 1) + rabit(n - 2) if __name__ == '__main__': n = int(input()) print(rabit(n))
兔子的数量
https://www.nowcoder.com/practice/8783056676de4396b0bf816a3561d62f
def rabit(n): if n == 1: return 2 elif n == 2: return 3 return rabit(n - 1) + rabit(n - 2) if __name__ == '__main__': n = int(input()) print(rabit(n))
相关推荐