解题思路:
注意事项:
参考代码:
我写的:
n = int(input()) q = 2; p = 1; a = 0 for i in range(0,n): a = a + q / p temp = q q = q + p p = temp print('{:.4f}'.format(a))
ChatGPT写的:
n = int(input()) q = 2; p = 1; a = 0 for i in range(0,n): a += q / p q, p = q + p, q # 交换分子和分母 print("{:.4f}".format(a))
0.0分
1 人评分