程序设计在线评测(Online Judge)

2017年湖南科技大学大学生计算机程序设计竞赛初定于12月17日举行!有意参赛请加QQ群“湖科大程序设计校赛群(369699377)”

问题 1031. -- Sum of Fibonacci Sequence

1031: Sum of Fibonacci Sequence

时间限制: 1 Sec  内存限制: 128 MB
提交: 176  解决: 110
[提交][状态][讨论版]

题目描述

The Fibonacci sequence of numbers is known: F1 = 1; F2 = 1; Fn+1 = Fn + Fn-1, for n>1. You have to find SUM(K) - the sum of the first K Fibonacci numbers.

输入

Each line contains a natural number K (0<K<38).

输出

For each case, output SUM(K) in one line. You may assume the result will be in the range of 32-bit signed integer

样例输入

5
9

样例输出

12
88

提示

参考例3.20

来源

[提交][状态][讨论版]