n=int(input("n=")) if n<0: print("n输入错误") exit(0) s,f1,f2=0,1,2 for i in range(n): t=f2/f1 s=s+t f1,f2=f2,f1+f2 print("前{}项的累加和为{:.2f}".format(n,s))