luogu#P1720. 月落乌啼算钱(斐波那契数列)

    ID: 695 远端评测题 1000ms 125MiB 尝试: 5 已通过: 5 难度: 1 上传者: 标签>模拟数学递推洛谷原创Fibonacci 数列

月落乌啼算钱(斐波那契数列)

Background

(This problem has no hidden song... no need to guess.)

The final chapter of "The Story of Love and Sorrow, Part 1 · heartache."

After eating pizza, Yue Luo Wu Ti knew he had gone over his budget. To avoid embarrassing himself in front of Ai Yu Chou, he braced himself to settle the bill.

Problem Description

After paying, Yue Luo Wu Ti thought, "You ripped me off!" So when Ai Yu Chou asked how much it cost, Yue Luo Wu Ti replied with a bunch of gibberish. Ai Yu Chou said, "Forget it, I only ask: what is the price of the nn-th dish?" Yue Luo Wu Ti wrote:

$$F_n=\dfrac{\left(\frac{1+\sqrt{5}}{2}\right)^n-\left(\frac{1-\sqrt{5}}{2}\right)^n}{\sqrt{5}}$$

Since Ai Yu Chou had studied programming, he computed FnF_n in 11 minute. Yue Luo Wu Ti was shocked. Can you, like Ai Yu Chou, compute the value of FnF_n?

Input Format

One line containing a non-negative integer nn.

Output Format

One line containing a real number FnF_n, with two decimal places.

6
8.00

Hint

For all testdata: 0n480 \leq n \leq 48.

Translated by ChatGPT 5