#C8662. Modified Fibonacci Sequence
Modified Fibonacci Sequence
Modified Fibonacci Sequence
In this problem, you are required to generate a Modified Fibonacci sequence. The sequence is defined as follows: given two integers \(a\) and \(b\) as the first two terms, each subsequent term is the sum of the two preceding terms. Formally, the sequence \(F\) is defined as:
\[ F(1) = a, \quad F(2) = b, \quad F(n) = F(n-1) + F(n-2) \text{ for } n \geq 3 \]
Your task is to output the first \(n\) terms of this sequence. For example, if \(a = 0\), \(b = 1\) and \(n = 10\), the sequence is: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.
inputFormat
The input consists of a single line containing three space-separated integers: \(a\), \(b\), and \(n\), where \(a\) and \(b\) are the first two terms of the sequence, and \(n\) (\(n \ge 1\)) is the number of terms to generate.
outputFormat
Output a single line with the first \(n\) terms of the Modified Fibonacci sequence separated by a single space.
## sample0 1 10
0 1 1 2 3 5 8 13 21 34