#C2555. Fibonacci Spiral Area
Fibonacci Spiral Area
Fibonacci Spiral Area
You are given a positive integer n. Your task is to generate the first n Fibonacci numbers, where the sequence is defined as:
\( F(1)=0, \quad F(2)=1, \quad F(n)=F(n-1)+F(n-2) \quad for \quad n \ge 3 \)
Then, consider that each Fibonacci number represents the side length of a square tile. The area of a single tile is the square of its Fibonacci number, i.e., \(F(i)^2\). The overall area covered by the first n tiles is the sum of these areas:
\( \text{Area} = \sum_{i=1}^{n} F(i)^2 \)
For example, if n=5, the Fibonacci sequence is [0, 1, 1, 2, 3] and the area is computed as:
\(0^2 + 1^2 + 1^2 + 2^2 + 3^2 = 15\)
You will be given multiple test cases and must output the computed area for each test case on a separate line.
inputFormat
The input starts with an integer T representing the number of test cases. This is followed by T lines, each containing one positive integer n.
outputFormat
For each test case, output the total area computed, with each result printed on a new line.
## sample3
1
2
4
0
1
6
</p>