Docoding OJ
Home
ProblemSet
Source/Category
Contest
Status
Ranklist
F.A.Qs
Login
Register
1877: 【信息学奥赛一本通】求分数序列和
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:75
Solved:63
Submit
Submit Record
Statistics
ShowOff!
Description
有一个分数序列
q1/p1,q2/p2,q3/p3,q4/p4,q5/p5,....
,其中
q(i+1)=qi+pi
,
p(i+1)=qi,p1=1,q1=2
。比如这个序列前
6
项分别是
2/1,3/2,5/3,8/5,13/8,21/13
。求这个分数序列的前
n
项之和。
Input
输入有一行,包含一个正整数
n(n≤30)。
Output
输出有一行,包含一个浮点数,表示分数序列前
n
项的和,精确到小数点后
4
位。
Sample Input
Copy
2
Sample Output
Copy
3.5000
Source/Category
基础
循环
for
白银
Submit
Submit Record
Statistics
ShowOff!