1571.Sleepy Kaguya

Time Limit: 1s Memory Limit: 256MB

Houraisan ☆ Kaguya is the princess who lives in Literally House of Eternity. However, she is very playful and often stays up late. This morning, her tutor, Eirin Yagokoro was going to teach her some knowledge about the Fibonacci sequence. Unfortunately, the poor princess was so sleepy in class that she fell asleep. Angry Eirin asked her to complete the following task:

This sequence can be described by following equations:

  1. $F[1]=F[2]=1$
  2. $F[n]=F[n-1]+F[n-2] (n \gt 2)$

Now, Kaguya is required to calculate $F[k+1] \times F[k+1]-F[k] \times F[k+2]$ for each integer $k$ that does not exceed $10^{18}$.

Kaguya is so pathetic. You have an obligation to help her.
(I love Houraisan Kaguya forever!!!)

82wEc09sxh8juXfqyivoAmYC6kHrMg7P728NH1ey.jpg

Input Format(From the terminal/stdin)

Only one integer $k$.

Output Format(To the terminal/stdout)

Only one integer as the result which is equal to $F[k+1] \times F[k+1]-F[k] \times F[k+2]$.

Sample Input

Copy
2
 \n

Sample Output

Copy
1
 \n

Hints

$F[2]=1,F[3]=2,F[4]=3$
$2 \times 2-1 \times 3=1$

PS:

$0 < k ≤ 1e^{18}$
If necessary, please use %I64d instead of %lld when you use "scanf", or just use "cin" to get the cases.
The online judge of HNU has the above feature, thank you for your cooperation.

Source: 2018 HNU新生赛

Submit

请先 登录

© 2025 FAQs