#C1474. Cupcake Baking Contest Scoring
Cupcake Baking Contest Scoring
Cupcake Baking Contest Scoring
In the Cupcake Baking Contest, every participant bakes a certain number of cupcakes. The score for each participant is determined by the sum of the first \(N\) Fibonacci numbers. The Fibonacci sequence is defined by the following recurrence relation:
\(F(1) = 1, \quad F(2) = 1, \quad F(n) = F(n-1) + F(n-2) \quad \text{for } n \ge 3\).
Thus, if a participant bakes \(N\) cupcakes, their total score is given by:
[ \text{Score} = \sum_{i=1}^{N} F(i) ]
Your task is to compute the total scores for all participants based on the number of cupcakes they baked.
Example: If the input is
3 3 5 7
Then the scores are computed as follows:
- For \(N = 3\): \(F(1) + F(2) + F(3) = 1 + 1 + 2 = 4\)
- For \(N = 5\): \(1 + 1 + 2 + 3 + 5 = 12\)
- For \(N = 7\): \(1 + 1 + 2 + 3 + 5 + 8 + 13 = 33\)
The output should be:
4 12 33
inputFormat
The input is provided via standard input (stdin) and consists of two lines:
- The first line contains a single integer \(T\) representing the number of participants.
- The second line contains \(T\) space-separated integers. Each integer \(N_i\) represents the number of cupcakes baked by the \(i\)-th participant.
outputFormat
Output a single line to standard output (stdout) containing \(T\) space-separated integers. Each integer is the total score of the corresponding participant, computed as the sum of the first \(N_i\) Fibonacci numbers.
## sample3
3 5 7
4 12 33
</p>