当前位置:网站首页>The 15th youth informatics competition in Shushan District in 2019

The 15th youth informatics competition in Shushan District in 2019

2022-07-04 19:20:00 Small Turing programming

The first question is Sum up

【 Problem description 】

Fiboracci series , Also called golden section series . Because mathematician Leonardo · Fibonacci introduced, for example, rabbit breeding , It is also called “ Rabbit Series ”, It refers to such a sequence :1、1、2、3、5、8、13、21、34、······ In Mathematics , Fibonacci sequence is defined recursively as follows :F(1)=1,F(2)=1,F(n)=F(n-1)+F(n-2)(n>=3).

The first two items of Fibonacci series are 1,1. Each subsequent item is the sum of the first two items . Now the input n, Before Fibonacci sequence n Sum of items (1<=n<=5000).

【 Input format 】sum.in

Enter only one number n, It means finding the front of Fibonacci sequence n Sum of items .

【 Output format 】sum.out

Before outputting Fibonacci series n Sum of items

原网站

版权声明
本文为[Small Turing programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207041739580118.html